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?
Thanks...
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?
Thanks...
You can pop to the "root" (first) view controller with
popToRootViewControllerAnimated
:UINavigationController
Reference:Swift Version as of (Swift 1.2 / Xcode 6.3.1) of popping twice or more
or
You can use the stack of the UIViewControllers. 1. Fetch the array of all the viewControllers in the stack. 2. Iterate through the whole array and find the desired viewController
by matching the class type. 3. Pop the viewController.