views:

580

answers:

1

How do you add the Navigation items on the popover (left pane) of the iPad's splitview? This is where the mailboxes/inbox/drafts part of the navigation is in the iPad's builtin email application.

+2  A: 

Make the UISplitViewController’s “master” pane a UINavigationController, then just push UIViewControllers on it that have navigationItems.

Here’s a sample setup:

UIViewController *masterController = [[MyCustomMasterController alloc] init…];
[[masterController navigationItem] setTitle:@"Root"];

UINavigationController *navController =
    [[UINavigationController alloc] initWithRootController:masterController];

UIViewController *detailController [[MyCustomDetailController alloc] init…];

UISplitViewController *splitView = [[UISplitViewController alloc] init];
[splitView setViewControllers:[NSArray arrayWithObjects:navController,
                                                        detailController,
                                                        nil]];

And then later on:

UIViewController *subController = [[MyCustomSubController alloc] init…];
[[masterController navigationController] pushViewController:subController
                                                   animated:YES];

Pushing a new UIViewController to the UINavigationController’s stack will cause a back button titled “Root” to appear for the MyCustomMasterController view.

phopkins