Split Views

A split view is implemented through a UISplitViewController (a UIViewController subclass) along with an array of two UIViewControllers whose views are to be displayed in the two regions of the split view. This array is the UISplitViewController’s viewControllers property; it can be configured in code or in a nib. A UIViewController contained in a UISplitViewController has a reference to the UISplitViewController through its splitViewController property.

There is very little work for you to do with regard to a split view. A split view controller has no further properties or methods beyond those inherited from UIViewController. You can hear about what the split view is doing through its delegate (adopting the UISplitViewControllerDelegate protocol):


The split view is rotating to portrait orientation, so it’s hiding the first view. The split view creates a UIBarButtonItem and hands it to you as the third parameter. Your mission, should you decide to accept it, is to put that UIBarButtonItem into the interface, typically in a toolbar at the top of the root view. Of course you are also free to configure the UIBarButtonItem’s title and image as well.

What you do with the other parameters is up to you, but none of them are needed; the split view has already set things up so that if you do put this UIBarButtonItem into the interface, then if the user taps it, a popover will be presented through ...

Get Programming iOS 4 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.