How do you add a "Back button" on the iPad's SplitViewController popover Navigation bar?
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 app开发者_开发技巧lication.
Make the UISplitViewController
’s “master” pane a UINavigationController
, then just push UIViewController
s on it that have navigationItem
s.
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.
精彩评论