How to dismiss a view controller opened with presentModalViewController:

99封情书 提交于 2019-12-20 12:30:55

问题


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


回答1:


You have two choices, both involves using dismissModalViewController.

The preferred way is to use delegation and tell the view controller who was responsible for presenting the view to dismiss it. The other way is to have the view who was presented to dismiss itself (which actually asks the parent to dismiss it.)




回答2:


For iOS6 use this code

[self dismissViewControllerAnimated:YES completion:Nil];

instead of

[self dismissModalViewControllerAnimated:YES];

This may help you.




回答3:


From the controller presented modally:

[self dismissModalViewControllerAnimated:YES]


来源:https://stackoverflow.com/questions/5156791/how-to-dismiss-a-view-controller-opened-with-presentmodalviewcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!