如何关闭使用presentModalViewController打开的视图控制器:
我使用 presentModalViewController:
呈现了一个视图控制器,现在如何关闭/关闭它?
I presented a view controller using presentModalViewController:
, now how to close/dismiss it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于 iOS6,请使用此代码
而不是
这可能会对您有所帮助。
For iOS6 use this code
instead of
This may help you.
从模态呈现的控制器:
From the controller presented modally:
你有两种选择,都涉及使用dismissModalViewController。
首选方法是使用委托并告诉负责呈现视图的视图控制器将其关闭。另一种方法是让提出的视图自行驳回(实际上要求父级驳回它。)
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.)