Dismissing multiple modal view controllers at once?(一次关闭多个模式视图控制器?)
问题描述
所以有一个包含三个视图控制器的堆栈,其中 A 是根,B 是第一个模态视图控制器,C 是第三个模态 vc.我想立即从 C 转到 A.我已经尝试过 这个解决方案解雇.它确实工作,但方式不正确.也就是说,当最后一个视图控制器被关闭时,它将在显示第一个视图控制器之前简要显示第二个视图控制器.我正在寻找的是一种在一个不错的动画中从第三个 vc 到第一个的方法,而不会注意到第二个视图.非常感谢您对此的任何帮助.
So have a stack with three view controllers where A is root, B is first modal view controller and C is third modal vc. I would like to go from C to A at once. I have tried this solution to dismiss.It does work but not in a correct way. That is when the last view controller is dismissed it will breifly show the second view controller before the first is shown. What I'm looking for is a way to get from the third vc to the first in one nice animation without noticing the second view. Any help on this is greatly appriciated.
推荐答案
确保你只调用 dismissModalViewControllerAnimated:
一次.
Be sure that you're only calling dismissModalViewControllerAnimated:
once.
我发现要求关闭每个堆叠的模态视图控制器会导致它们都产生动画.
I have found that asking to dismiss each stacked modal view controller will cause both of them to animate.
你有:A =modal>B =模态>C
你应该只调用 [myViewControllerA dismissModalViewControllerAnimated:YES]
如果您使用 [myViewControllerB dismissModalViewControllerAnimated:YES]
,它将关闭 C,而不是 B.在正常(未堆叠)使用中,它会关闭 B(由于响应者链使消息冒泡到 A).在您描述的堆叠场景中,B 是父视图控制器,这优先于作为模态视图控制器.
If you use [myViewControllerB dismissModalViewControllerAnimated:YES]
, it will dismiss C, and not B. In normal (unstacked) use, it would dismiss B (due to the responder chain bubbling the message up to A). In the stacked scenario that you describe B is a parent view controller and this takes precedence over being a modal view controller.
这篇关于一次关闭多个模式视图控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:一次关闭多个模式视图控制器?


基础教程推荐
- iOS4 创建后台定时器 2022-01-01
- Firebase 云消息传递令牌未生成 2022-01-01
- UINavigationItem 的持久 rightBarButtonItem 属性 2022-01-01
- EditText 中的 setHintTextColor() 2022-01-01
- 更改 UITableView 部分标题的颜色 2022-01-01
- 从 UIWebView 访问元数据 2022-01-01
- UINavigationBar 隐藏按钮文本 2022-01-01
- 在视图控制器的宽度上水平均匀分布 UIButton 的最简单方法? 2022-01-01
- 在 iOS 7 下 CCMenu 错位 2022-01-01
- Android - 如何在runOnUiThread 中将数据传递给Runnable? 2022-01-01