一次解除多个模态视图控制器? [英] Dismissing multiple modal view controllers at once?

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

问题描述

所以有一个带有三个视图控制器的堆栈,其中A是root,B是第一个模态视图控制器,C是第三个模态vc。我想立刻从C到A。我试过此解决方案解雇。它工作但不是以正确的方式。也就是说,当最后一个视图控制器被解除时,它将在显示第一个视图控制器之前完全显示第二个视图控制器。我正在寻找的是一种从第三个vc到第一个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 =模态> 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天全站免登陆