Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the popViewController could not pop the root right view controller #4

Open
flypigz opened this issue Dec 26, 2011 · 0 comments
Open

Comments

@flypigz
Copy link

flypigz commented Dec 26, 2011

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];
    }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant