Devang
Devang

Reputation: 11338

iPhone : How to achieve functionality similar to popToRootViewController using modalView?

In my app I am presenting many view one on the top of another.

So when I want to come out of all the views, I have to press cancel many times.

for example, HOME->OneViwe(modalView)->SubView(modalView).

How do I directly come to HOME from SubView?

Is there any way to directly come out from all the view?

Or can I dismiss one view after presenting another view? How?

Upvotes: 0

Views: 180

Answers (2)

Steve N
Steve N

Reputation: 2737

For a little more flexibility, check out the utility method I use for stuff like this here:

How to dismiss the two or more dismissModalViewController?

Upvotes: 0

EmptyStack
EmptyStack

Reputation: 51374

You can call dismissModalViewContorller on a view controllers parentViewController property. You can use the parentViewController hierarchy until the view controller you want to dismiss completely. If there are three modal view controllers in the hierarchy, your code should look like,

[self.parentViewController.parentViewController dismissModalViewControllerAnimated:YES];

Upvotes: 2

Related Questions