Popviewcontroller for the previous two pages

The popviewcontroller in the navigation manager only displays the current page and sends us to the previous page. Is there a way to jump two pages and go back to the previous page (2 pages back), or should I click on this page. thanks

+4
source share
1 answer

Use this method for a 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]; } 
+20
source

All Articles