Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dismiss two UIViewControllers

I have search around the web and there´s a lot of question like this, but i cant find the answer, it seems like everyone uses navigationcontroller and i am just using uiviewcontroller i am showing a UIViewcntroller like this:

[self presentViewController:controller animated:NO completion:nil];

When i realease the controller to show a controller before i use:

[self dismissViewControllerAnimated:NO completion:nil];

What i have is A->B->C in C i need to dismiss C and B UIViewControllers, how do i achieve this?

like image 795
Fernando Santiago Avatar asked Dec 02 '25 11:12

Fernando Santiago


1 Answers

You can try this approach :

 [self.presentingViewController.presentingViewController dismissViewControllerAnimated:NO completion:nil];

From C where you want to go to views back just put this line and it will lead you directly to A.

You can also use NSNotificationCenter.

Hope this helps you.

like image 96
Manthan Avatar answered Dec 05 '25 01:12

Manthan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!