Is there a way to go back to the previous navigation controller?

I have a basic navigation controller that integrates a tab bar controller. inside this controller of the tab bar there is another controller of the controller embedded in it. If I am in the controller of the child navigator, I can view it in the root view in one of the views, but it will only lead me to the root view of the CHILD navigation controller. Is there a way to get back to the first navigation controller?

+3
source share
2 answers

If you are using a storyboard , you can use the Unwind segue method , which always works for me

enter image description here

+ "Pop to Main Screen" UIButton to Exit ( ) , "Main",

-(IBAction)customUnwind:(UIStoryboardSegue *)sender
{

    NSLog(@"Unwind successful");

}
+2

,

 UITabBarController *tc = (UITabBarController *)self.navigationController.parentViewController;
[tc.navigationController popToRootViewControllerAnimated:YES];
+1

All Articles