查看不可用dismissViewControllerAnimated后:完成: [英] View unusable after dismissViewControllerAnimated:completion:
问题描述
我移植较老的code所用钞使用手动视图创建(的loadView
)和自动布局的。根视图控制器是一个容器VC (含2名儿童),使用自动布局和模态presents有一个NIB指定的布局,还没有使用自动布局的视图控制器。所有 presentViewController后罚款:动画:完成:
,但是当模态视图与收dismissViewControllerAnimated:完成:
通过委托调用,presenting视图留在内容古怪移动并没有反应碰一个陌生的,不可用状态。
I'm migrating older code that used NIBs to use manual view creation (loadView
) and Auto Layout. The root view controller is a container VC (with 2 children) that uses auto layout and modally presents a view controller that has its layout specified in a NIB and does not yet use auto layout. All is fine after presentViewController:animated:completion:
, but when the modal view is closed with dismissViewControllerAnimated:completion:
via delegate call, the presenting view is left in a strange, unusable state where the content is weirdly shifted and does not react to touch.
我曾尝试创建最小的测试案例重现该问题,但我没能重现该问题。
I have tried to create minimal test case to reproduce the problem, but I've failed to reproduce the issue.
什么引起的?
推荐答案
我设置 translatesAutoresizingMaskIntoConstraints = NO;
我的根的UIView
。
它显示外层的UIView
- 在您的视图层次必须使用默认的根目录下的上海华 translatesAutoresizingMaskIntoConstraints = YES
。
一旦我删除这一点,一切都如预期。
I was setting translatesAutoresizingMaskIntoConstraints = NO;
on my root UIView
.
It appears the "outermost" UIView
— the superview at the root of your view hierarchy must use the default translatesAutoresizingMaskIntoConstraints = YES
.
Once I've removed this, everything worked as expected.
这篇关于查看不可用dismissViewControllerAnimated后:完成:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!