Reputation: 38162
Is there any way to quickly go to rootViewController
? I want to remove all views from the stack & return to rootViewController
without even bothering the sequence of views on top of it.
Upvotes: 3
Views: 6782
Reputation: 2589
First I think you need to dismiss presented model then you can pop all the pushed view controllers. As presented model would not be in the stack of the navigation.
[self dismissModalViewControllerAnimated:YES];
Then you can pop to base view controller.
[self.navigationController popToRootViewController:YES];
Upvotes: 4
Reputation: 43330
From the docs:
popToRootViewControllerAnimated: Pops all the view controllers on the stack except the root view controller >and updates the display.
- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated
Parameters
animated:
Set this value to YES to animate the transition. Pass NO if you are setting >up a navigation controller before its view is displayed.
Return Value:
An array of view controllers that are popped from the stack.
Upvotes: 8