Question

How do you see how many layers you are removed from rootViewController in stack with UINavigation?

Was it helpful?

Solution

This depends on how your view hierarchy is setup. If you root view controller is a navigation controller and all you have done is pushed view controllers on to the navigation controller then simply look the 'viewControllers` property of the navigation controller. Its count tells you how many view controllers have been pushed.

NSUInteger count = [self.navigationController.viewControllers count];

It gets a bit more complicated if you have presented any modal controllers onto the stack.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top