简体   繁体   中英

Best way and how to display multiple views in a mac osx cocoa application?

I am learning to create a simple cocoa mac osx application. However, I need to research a few things before jumping in. I am coming from a background in iOS development. I am trying to see what is the best way to replicate the interface below.

http://macmagazine.com.br/wp-content/uploads/2011/08/08-sparrow.png?cda6c1

I want to show multiple views like the one below. I have an idea on how to accomplish this, but not sure if it is the best way. In my app delegate, I am thinking about making references to 3 different views . Then, display each one as a subview for the main view. Is this a good idea and if this is possible can someone show me some example code on how to achieve this?

The code below is what I had in mind. self.window represents the window in the mainview.

[self.window.contentView addSubview:self.ViewController1.view];
[self.window.contentView addSubview:self.ViewController2.view];

That looks like a NSSplitview. You can set the size of the subviews for the SplitView in a xib/storyboard to get it the width you would like.

There is more documentation here:

https://developer.apple.com/library/prerelease/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSSplitView_Class/index.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM