iPad:在 RootView 中合并 SplitViewController 和 NavigationController 的概念? [英] iPad: Merge concept of SplitViewController and NavigationController in RootView?
问题描述
我无法合并在我的主视图中使用 SplitViewController 和使用RootView"控制器来控制左侧窗格弹出/侧边栏表格视图这两个概念.
I'm having trouble merging the two concepts of using a SplitViewController in my main view and having the "RootView" controller that controls the left panes popup/sidebar table view.
我想让左侧的RootView"充当导航菜单,但是当 RootView 通过 MainWindow.xib 绑定到 SplitView 的左侧窗格时,我该怎么做?
I want to have the left "RootView" act as a navigation menu, but how do I do this when the RootView is tied through MainWindow.xib into the left pane of the SplitView?
基本上,我希望左侧导航能够像内置的电子邮件应用程序文件夹向下钻取导航一样工作.是否有一个示例 iPad 项目同时使用 SplitView 和 NavigationView 作为左/根窗格?
Basically, I want the left navigation to work just like the built-in email applications folder drilldown navigation. Is there an example iPad project out there that uses both SplitView and a NavigationView for the left/Root pane?
推荐答案
创建 SplitView 项目后,打开 RootViewController.m 文件并查看 -tableViewDidSelectRowAtIndexPath 方法.您会看到您单击的项目随后被设置为 DetailViewController 的属性.
After you create a SplitView project, open up the RootViewController.m file and look at the -tableViewDidSelectRowAtIndexPath method. You'll see that the item that you clicked is then set as a property of the DetailViewController.
您正在寻找的设计要求您将另一个视图控制器推送到导航堆栈上.因此,如果您想象电子邮件应用程序,当用户选择一个文件夹时,detailView 不会更新,而是将收件箱的下一级推送到堆栈上.当用户从收件箱中选择一条消息时,详细视图会使用消息内容进行更新,而 RootViewController 将停留在它所在的位置.
The design you're looking for would require that you push another view controller onto the navigation stack. So if you imagine the e-mail application, when a user picks a folder, the detailView is not updated, but the next level of the Inbox is pushed onto the stack. When a user selects a message from the inbox, the detail view is updated with the message contents, and the RootViewController just stays where it's at.
在 -tableViewDidSelectRowAtIndexPath 方法中,声明你的新视图控制器
in the -tableViewDidSelectRowAtIndexPath method, declare your new view controller
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
这有意义吗?
这篇关于iPad:在 RootView 中合并 SplitViewController 和 NavigationController 的概念?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!