解决多模态视图控制器时出现问题 [英] Problem dismissing multiple modal view controllers
问题描述
我无法让我的模态视图控制器正常显示。我有一个父视图控制器,它是模态视图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.
事件顺序:
- 父视图显示模式视图A
- 模式视图A在模态视图中显示模态视图B控制器
- 通过授权查看A控制器
- 这是我的UI挂起的地方,我可以看到Modal View B但不能点击它,或者做任何事情
- Parent View show Modal View A
- Modal View A shows Modal View B in Modal View A controller
- Parent View dismisses Modal View A in Modal View A controller via delegation
- 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屋!