How to dismiss a view controller opened with prese

2019-03-15 01:12发布

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

3条回答
仙女界的扛把子
2楼-- · 2019-03-15 01:26

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.)

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-03-15 01:32

From the controller presented modally:

[self dismissModalViewControllerAnimated:YES]
查看更多
Root(大扎)
4楼-- · 2019-03-15 01:41

For iOS6 use this code

[self dismissViewControllerAnimated:YES completion:Nil];

instead of

[self dismissModalViewControllerAnimated:YES];

This may help you.

查看更多
登录 后发表回答