Using NSSplitView without Cluttering Interface Builder

Discussion in 'Mac Programming' started by Littleodie914, Oct 18, 2010.

  1. macrumors 68000

    Littleodie914

    Joined:
    Jun 9, 2004
    Location:
    Rochester, NY
    #1
    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:
     

    Attached Files:

  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    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.
     
  3. thread starter macrumors 68000

    Littleodie914

    Joined:
    Jun 9, 2004
    Location:
    Rochester, NY
    #3
    That's what I was afraid of, but I suppose it's not too terrible a solution. Well worth avoiding all the confusion. :)
     

Share This Page