iPad:在RootView中合并SplitViewController和NavigationController的概念? [英] iPad: Merge concept of SplitViewController and NavigationController in RootView?

查看:97
本文介绍了iPad:在RootView中合并SplitViewController和NavigationController的概念?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在合并在主视图中使用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和左/ Root窗格的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆