解决多模态视图控制器时出现问题 [英] Problem dismissing multiple modal view controllers

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

问题描述

我无法让我的模态视图控制器正常显示。我有一个父视图控制器,它是模态视图A的代理。在模态视图中,AI呈现模态视图B,并具有委托dimiss模态视图A.

I am having trouble getting my modal view controllers to display properly. I have a parent view controller that is the delegate for modal view A. In modal view A I am presenting modal view B, and having the delegate dimiss modal view A.

当模式视图B出现时,它似乎显示,但屏幕变暗, UI锁定,但应用程序不会崩溃。我将动画设置设置为NO,我仍然遇到同样的问题。

When modal view B appears it seems to display but the screen dims, and the UI locks up, but the app doesn't crash. I set animation settings to NO and I am still getting the same issue.

事件顺序:


  1. 父视图显示模式视图A

  2. 模式视图A在模态视图中显示模态视图B控制器

  3. 通过授权查看A控制器

  4. 这是我的UI挂起的地方,我可以看到Modal View B但不能点击它,或者做任何事情

  1. Parent View show Modal View A
  2. Modal View A shows Modal View B in Modal View A controller
  3. Parent View dismisses Modal View A in Modal View A controller via delegation
  4. This is where my UI hangs, I can see Modal View B but can't click on it, or do anything


推荐答案

通过让我的parentViewController作为委托来解决。这是我的命令:

Solved by having my parentViewController act as the delegate. Here is my order:

[parentView presentViewController:modalViewControllerA animated:YES]
[parentView dismissModalViewControllerAnimated:YES]
[parentView presentViewController:modalViewControllerB animated:YES]
//Modal B dismisses himself

在我的委托方法中,我需要确保我在提交Modal B之前关闭了Modal A

In my delegate method, I needed to make sure that I dismissed Modal A before presenting Modal B

这篇关于解决多模态视图控制器时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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