PDA

View Full Version : Using NSSplitView without Cluttering Interface Builder




Littleodie914
Oct 18, 2010, 05:47 PM
I'm using an NSSplitView in my application. Dragging and dropping controls into the two Custom Views provided causes an enormous amount of clutter and confusion when trying to resize the app, select specific objects, etc.

Is there a way in Interface Builder to have an object "reference" another object? For example, in the screenshot below, is there a way to tell Interface Builder that the Custom View in the left pane of the split view "is" the Left View I created? Can I assign them the same "Object ID"? It would be very convenient to focus on one pane of the split view at a time. Especially if you were to embed an NSSplitView in another NSSplitView. Certainly Apple can't expect us to contain all that in a single window!

This kind of clutter has been alleviated in the iPhone XIB files, as you can reference one XIB from another, but I haven't found an efficient way of completing this same task using IB to develop a Mac OS X application interface. :confused:



kainjow
Oct 18, 2010, 07:47 PM
I think the only way to do this is with a little code, but IMO it's worth it: create a subclass of NSSplitView and add two NSView outlets. In the subclass' awakeFromNib, set the two views as the split view's subviews. Finally, in IB set the class name on the NSSplitView and connect the outlets to your custom views.

Littleodie914
Oct 18, 2010, 09:10 PM
I think the only way to do this is with a little code, but IMO it's worth it: create a subclass of NSSplitView and add two NSView outlets. In the subclass' awakeFromNib, set the two views as the split view's subviews. Finally, in IB set the class name on the NSSplitView and connect the outlets to your custom views.That's what I was afraid of, but I suppose it's not too terrible a solution. Well worth avoiding all the confusion. :)