How can I go to the top level of the UINavigationController in one UITabBarController from another UINavigationController to another UITabBarController?

OK, so this is the scenario:

I have a tab bar app with a UINavigationController on each tab. Suppose I have two tabs: Home and Output. In the "Home" the user monitors the navigation based on UINavigation, to 3 levels and the press gives. After that, click "Exit", click the checkout button.

I want to do the following:

Return the user to the first tab "Home", and then perform the "Pop-root navigation controller"

My code in the sign:

[[self tabBarController]setSelectedIndex:0]; //this takes me to the first tab "Home"

[self.navigationController popToRootViewControllerAnimated:YES]; //this does not work

How should I do it?

+3
source share
1 answer

pop , - :

UIViewController *selectedController = [[self tabBarController] selectedController];
[[selectedController navigationController] popToRootViewControllerAnimated: YES];
+2

All Articles