Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dismiss a view controller opened with presentModalViewController:

I presented a view controller using presentModalViewController:, now how to close/dismiss it?

like image 758
WangYang Avatar asked Mar 01 '11 15:03

WangYang


People also ask

How do I dismiss a specific view controller in Swift?

Use unwind segue instead of using RootViewController. Using unwind you can go back to any ViewController. DismissViewController always send the controller out from NavigationController. Show activity on this post.

How do you dismiss a presented view controller in Objective C?

When it comes time to dismiss a presented view controller, the preferred approach is to let the presenting view controller dismiss it. In other words, whenever possible, the same view controller that presented the view controller should also take responsibility for dismissing it.

How do you dismiss a popover?

Dismiss on next clickUse the focus trigger to dismiss popovers on the user's next click of a different element than the toggle element.


2 Answers

For iOS6 use this code

[self dismissViewControllerAnimated:YES completion:Nil];

instead of

[self dismissModalViewControllerAnimated:YES];

This may help you.

like image 97
Nithinbemitk Avatar answered Sep 24 '22 02:09

Nithinbemitk


From the controller presented modally:

[self dismissModalViewControllerAnimated:YES]
like image 39
r36363 Avatar answered Sep 25 '22 02:09

r36363