Switching to the old answer hard updates it to be more complete.
To resolve this issue:
Can someone explain the navigation hierarchy and how to trace the chain back programmatically?
The structure of your navigation:
tabbarVC → navigationVC-1 → tableVC-1 - (via segue push) → tableVC-2 - (via segue modal) → navigationVC-2 → tableVC-3
You can explain it like this:
TabbarVC shows its 'selectedViewController' (navigationVC-1).
NavigationVC-1 has its own navigation stack consisting of TableVC-1 and TableVC-2 (topViewController of NavigagtionVC-1)
Then NavigationVC-2 is presented Modically over tabbarVC, so tabbarVC is presentingViewController , and NavigationVC-2 is presentedViewController
So, in order to reach tableVC-2 from tableVC-3, you will need to do something like this:
[(UINavigationController *)[(UITabBarController *)[tableVC-3 presentingViewController] selectedViewController] topViewController];
(do not do this in production code)
[tableVC-3 presentingViewController] , as well as [tableVC-3.navigationController presentingViewController] will return you a UITabBarController .
If you are using the UINavigationController , you must use the push and pop method to enable or disable the UIViewController "view stack".
You will be able to access the UINavigationController from these UIViewController as follows:
self.navigationController
If you want to return to more than one UIViewController in the presentation stack, you can use this method on the UINavigationController
popToViewController: animated:
Controls the controllers until the specified view controller is at the top of the navigation stack.
- (NSArray *) popToViewController: (UIViewController *) viewController animated: (BOOL) animated
To reject a UIViewController that was presented modally, the UIViewController that introduced it should reject it with:
- (void)dismissModalViewControllerAnimated:(BOOL)animated
So, in this case it should be:
[tableVC-2 dismissModalViewControllerAnimated:YES]