ANAdvancedNavigationController
ANAdvancedNavigationController copied to clipboard
the popViewController could not pop the root right view controller
the popViewController method re-use the popViewControllerToViewControl, which lead to this limitation, it does not support pop all of the right view controllers....
instead, i think the popViewControllerToViewControl should re-use code of popViewController method..
-
(void)popViewController:(UIViewController *)viewController animated:(BOOL)animated { NSLog(@"%s", PRETTY_FUNCTION); if (![self.viewControllers containsObject:viewController]) { NSLog(@"viewController (%@) is not part of the viewController Hierarchy", viewController); return; }
// this method re-use the _popViewControllersToViewController, which require at least // one left size view controller to specify the location to pop, so it does not // support poping the root right view controller
NSInteger index = [self.viewControllers indexOfObject:viewController]-1; // why
NSLog(@"index: %d", index); ===> if the root right viewcontroller is passed as parameter, the index is -1 here...
if (index >= 0) { viewController = [self.viewControllers objectAtIndex:index]; [self _popViewControllersToViewController:viewController animated:animated]; } }