IPad: Combine SplitViewController and NavigationController concept in RootView?

I am having trouble combining the two concepts of using SplitViewController in my main view and with the RootView controller that controls the left pane's popup / sidebar table view.

I want the left "RootView" to act like a navigation menu, but how do I do that when the RootView is bound to MainWindow.xib in the left pane of the SplitView?

Basically, I want the left navigation to work the same as the built-in folder navigation bar for mail applications. Is there an example iPad project that uses both SplitView and NavigationView for the left / root bar?

+2


a source to share


1 answer


After creating the SplitView project, open the RootViewController.m file and look at the -tableViewDidSelectRowAtIndexPath method. You will see that the item you clicked is then set as a property of the DetailViewController item.

The construct you are looking for will require you to push another view controller onto the navigation stack. Therefore, if you are presenting an email application when the user selects a folder, the detailView is not refreshed, but the next level of the Inbox is pushed onto the stack. When the user selects a message from the Inbox, the detail view is updated with the content of the message and the RootViewController simply stays where it is.

in the -tableViewDidSelectRowAtIndexPath method, declare a 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 now retained automatically by the NavigationController

      

It makes sense?

+4


a source







All Articles