开发者

Dismiss two modal view controllers

I have a navigation controller which present one modal viewController. From inside this modal viewController I present another modal viewController. All I want is to get back from the last modal viewController to the navigationController (the root viewController).Something similar with popToRootViewController, but adapted for modalViewControllers;

NavigationController -> present Modal ViewController A -> present Modal ViewController B

From modal ViewCOntroller B I want to return to navigationCOntroller.

Is this possible?

Appreciate, Al开发者_如何转开发ex.


In iOS 5 you need to do

[self.presentingViewController.presentingViewController dismissModalViewControllerAnimated:YES]

Edit: As of iOS 6 dismissModalViewControllerAnimated: is deprecated.

You need to call

[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:^{ // Do something on completion}]


Problem solved :)

I tried

[self.parentViewController.parentViewController dismissModalViewControllerAnimated:YES];    

and works.

Thanks.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜