如何在iPad的SplitViewController popover导航栏上添加“后退按钮”?

时间:2010-04-17 20:11:24

标签: ipad

如何在iPad的splitview的弹出窗口(左侧窗格)中添加导航项?这是导航的邮箱/收件箱/草稿部分位于iPad内置电子邮件应用程序中的位置。

1 个答案:

答案 0 :(得分:3)

UISplitViewController的“主”窗格设为UINavigationController,然后只需按UIViewController s上的navigationItem

以下是一个示例设置:

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]];

然后是:

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

将新的UIViewController推送到UINavigationController的堆栈会导致MyCustomMasterController视图显示标题为“Root”的后退按钮。