一次关闭多个模式视图控制器? [英] Dismissing multiple modal view controllers at once?

查看:22
本文介绍了一次关闭多个模式视图控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以有一个包含三个视图控制器的堆栈,其中 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.

这篇关于一次关闭多个模式视图控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆