Fernando Santiago
Fernando Santiago

Reputation: 2288

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?

Upvotes: 3

Views: 88

Answers (1)

Manthan
Manthan

Reputation: 3914

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.

Upvotes: 2

Related Questions