I\'ve got a UINavigationController
with a series of UIViewControllers
on it. Under some circumstances, I want to pop back exactly two levels. I thoug
I think its better to count the number of view controllers in you stack and then subtract the number of view controllers you would like to pop.
NSInteger noOfViewControllers = [self.navigationController.viewControllers count];
[self.navigationController
popToViewController:[self.navigationController.viewControllers
objectAtIndex:(noOfViewControllers-2)] animated:YES];
With this solution you wont mess up the pop if you add a new view to your project later.