Bogdan
Bogdan

Reputation: 412

Dismiss two TableViewControllers

I have a View that has a button in it, something like this Button---(segue)---> TableViewControllerNO1-----(segue)-->TableViewControllerNO2. In the TableViewControllerNO2 I delete all the rows by pressing a button and I want after I delete the rows to return to the first View, the one before the TableViewControllerNO1, how can I dismiss the two TableViewControllers from TableViewControllerNO2?

Upvotes: 0

Views: 33

Answers (2)

Matteo Gobbi
Matteo Gobbi

Reputation: 17717

You have a cool method to do this: popToViewController

[self.navigationController popToViewController:viewController animated:YES];

So the important is inject a reference to that viewController.

Otherwise you can also do:

[self.navigationController popViewControllerAnimated:NO];
[self.navigationController popViewControllerAnimated:YES];

but the right way is the first.

Upvotes: 2

Andrew Monshizadeh
Andrew Monshizadeh

Reputation: 1794

You should use - (NSArray *)popToRootViewControllerAnimated:(BOOL)animated (assuming you are using a navigation controller). This would take you all the way back to the root view controller in your navigation stack, and use the standard animation.

Upvotes: 1

Related Questions