我无法合并在主视图中使用 SplitViewController 和控制左窗格弹出/侧边栏表视图的“RootView”控制器这两个概念。
我想让左侧的“RootView”充当导航菜单,但是当 RootView 通过 MainWindow.xib 绑定到 SplitView 的左窗格中时,我该如何执行此操作?
基本上,我希望左侧导航像内置电子邮件应用程序文件夹深入导航一样工作。是否有一个示例 iPad 项目在左/根窗格中同时使用 SplitView 和 NavigationView?
创建 SplitView 项目后,打开 RootViewController.m 文件并查看 -tableViewDidSelectRowAtIndexPath 方法。您将看到您单击的项目随后被设置为 DetailViewController 的属性。
您正在寻找的设计需要将另一个视图控制器推送到导航堆栈上。因此,如果您想象一下电子邮件应用程序,当用户选择一个文件夹时,detailView 不会更新,但收件箱的下一级会被推送到堆栈上。当用户从收件箱中选择一条消息时,详细信息视图将使用消息内容进行更新,并且 RootViewController 仅停留在其所在位置。
在 -tableViewDidSelectRowAtIndexPath 方法中,声明新的视图控制器
NextViewController *nextView = [[NextViewController alloc] initWithStyle:UITableViewStylePlain];
//This assumes you have another table view controller called NextViewController
//We assign it to the instance variable "nextView"
[self.navigationController pushViewController:nextView animated:YES];
//tells the navigation controller to "slide" the "nextView" instance on top
//if animated:NO it wouldn't slide, it would just "update"
[nextView release];
//release the viewController, it's now retained automatically by the NavigationController
这有道理吗?
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)