Popviewcontroller in navigationcontroller pops out just current page and sends us to previous page. Is there a way to pop out two pages and go back to page prior to previous one(2 pages back) or i have to push it to that page. thanks
Use this method on UINavigationController:
- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated
Like this:
NSInteger currentIndex = [self.navigationController.viewControllers indexOfObject:self];
if( currentIndex-2 >= 0 ) {
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:currentIndex-2] animated:YES];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With