开发者

How do you add a "Back button" on the iPad's SplitViewController popover Navigation bar?

开发者 https://www.devze.com 2022-12-27 01:10 出处:网络
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开发者_开发技

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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消