iPad for iPhone Developers 101 in iOS 6: UISplitView Tutorial

This is the first part of a three-part series to help get iPhone Developers up-to-speed with iPad development by first focusing on three of the most useful classes: UISplitView, UIPopoverController, and Custom Input Views. By Ellen Shapiro.

Leave a rating/review
Save for later
Share
You are currently viewing page 4 of 4 of this article. Click here to view the first page.

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!

Contributors

Over 300 content creators. Join our team.