I want to pop to the third view on the navigation stack back to the first view.
I know how to pop one view at once:
[self.navigationController popViewControllerAnimated:YES];
But how do I do two at once?
There's also a setViewControllers(_:animated:) to include the pop animation. Alternatively you could find the second last view controller in the viewControllers array and then use popToViewController to avoid overwriting the entire view controller stack.
You can try this to Jump between the navigation controller stack as well
NSMutableArray *allViewControllers = [NSMutableArray arrayWithArray:[self.navigationController viewControllers]]; for (UIViewController *aViewController in allViewControllers) { if ([aViewController isKindOfClass:[RequiredViewController class]]) { [self.navigationController popToViewController:aViewController animated:NO]; } }
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