开发者

iPad: Merge concept of SplitViewController and NavigationController in RootView?

开发者 https://www.devze.com 2022-12-27 02:16 出处:网络
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.

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.

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?

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?


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消