Home > Articles > Home & Office Computing > Mac OS X

  • Print
  • + Share This
This chapter is from the book

6.4 A Split View

Our idea of how much space to allocate between the table of data points and the form containing the output statistics might not be the one that should control. The user may have other ideas. It would be better to put the two views inside a split view so the user can drag the border between them back and forth.

Interface Builder does not provide an NSSplitView or an NSScrollView in its palettes, except for the ones prebuilt around other views. To get a split view, select the views you want to be in the split view—in this case, the scroll view containing the data table and the NSForm for the results. Then select the menu item Layout U2192.GIF Make subviews of U2192.GIF Split View to wrap the views in a split view big enough to contain them and oriented so the split comes between them. See Figure 6.11.


Figure 6.11 Adding a split view. Selecting two side-by-side views, and using the menu command Layout U2192.GIF Make subviews of U2192.GIF Split View encloses the views in an NSSplitView, with the splitter between them.

Try out the new view by pressing command-R. The halves of the split view should resize as you drag the dimpled bar between them. The new split view comes with no automatic resizing, so when you return Interface Builder to its normal editing mode, you'll want to set the split view's internal struts to springs so it can resize with the window.

  • + Share This
  • 🔖 Save To Your Account