Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quickly returning to RootViewController

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.

like image 668
Abhinav Avatar asked May 15 '26 20:05

Abhinav


2 Answers

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.

like image 194
CodaFi Avatar answered May 17 '26 13:05

CodaFi


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];
like image 30
Kuldeep Avatar answered May 17 '26 14:05

Kuldeep