Using a UINavigationController Instead
In this project, you’re using a custom view with a static UINavigationBar on the right hand side. However in your projects, you might want to use a UINavigationController on the right side instead, to allow you to navigate further views on the right. How can you set it up so that the bar button item goes into the UINavigationController’s toolbar?
To do this, all you need to do is get a reference to your UIViewController’s navigationItem property, and in the willHideViewController method simply set the left bar button item as you are in your current version:
UINavigationItem *navItem = [self navigationItem];
[navItem setLeftBarButtonItem:barButtonItem animated:YES];
Note that if your UIViewController is not in a UINavigationController’s View Controller stack, navigationItem will be nil.
Where To Go From Here?
Here’s an example project with all of the code you’ve developed so far.
So – that’s how you can use UISplitViewController, from the ground up. Note in practice you’re likely to just use the Master-Detail template to save time – but now you should know much better how it works.
Continue on with the next part of the series, where you’ll learn how to use popovers on the iPad!
Or if you have any questions or comments, please join the forum discussion below!