David Wilson
David Wilson

Reputation: 27

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];

Upvotes: 1

Views: 294

Answers (1)

Will
Will

Reputation: 1696

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

Upvotes: 2

Related Questions