iPad: Merge concept of SplitViewController and NavigationController in RootView?

冷暖自知 提交于 2019-12-03 00:50:13

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.

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.

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

Does this make sense?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!