简体   繁体   中英

Add new TableView to another UINavigationController

My app setup is the following

在此输入图像描述

With this setup, when I press the button in table 2 it pushes the view (table3) in the "nav 2" hierarchy.

What I need to do is to press the button on table 2 and push the view (table3) but in the hierarchy of the "nav 1". And if I press the "back" button in table 3, I want to go to the "Table 1", and NOT being able to return to the table2 view.

I need to do this programmatically. Im a beginner in iOS development, and I know I should modify use the method:

[self.navigationController pushViewController:..........];

But the problem is that in this way I am pushing it to the navigation controller of "self" meaning nav2. How do I push it to nav1?

NOTE: The layout I need is similar to the one found in "Messages" app when adding a new message thread.

Thank you!

If you are trying to model the Messages app of navigation, you need to present a modal view controller with a navigation controller.

NewViewController *newVC = [[NewViewController alloc] initWithNibName:@"NewViewController" bundle:nil];
UINavigationController *newNav = [[UINavigationController alloc] initWithRootViewController:newVC];
[newVC release];
[self.navigationController presentModalViewController:newNav animated:YES];

In the message app, it looks like they are presented in a modal view. Then if you press the + button to get to the contacts it brings up another modal view wrapped in a NavigationController. If your using X-ode 4.2 and create a new ViewController in the storyboard there an option in the editor menu to embed that view in a NavigationController. then just present that view modally.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM