我的布局在iOS 9的Xcode 11中被破坏。该视图包含UIStackView,该UIStackView固定在安全区域的底部。当我为iOS> 9构建时,一切都很好。但是,当我想为iOS 9构建时,布局就此被破坏了
"<_UILayoutSupportConstraint:0x7fb923064c00 _UILayoutGuide:0x7fb923063770.height == 0>",
"<_UILayoutSupportConstraint:0x7fb92303dd30 _UILayoutGuide:0x7fb923063770.bottom == UIView:0x7fb9230475c0.bottom>",
"<NSLayoutConstraint:0x7fb921f08190 UICollectionView:0x7fb922841400.height == 70>",
"<NSLayoutConstraint:0x7fb923064210 _UILayoutGuide:0x7fb923063770.top == UIStackView:0x7fb923047770.bottom + 16>",
"<NSLayoutConstraint:0x7fb92371ebd0 UIStackView:0x7fb923047770.bottom == UICollectionView:0x7fb922841400.bottom>",
"<NSLayoutConstraint:0x7fb92371bfd0 UIView:0x7fb9230475c0.height == 736>",
"<NSAutoresizingMaskLayoutConstraint:0x7fb92371ca00 UIView:0x7fb9230475c0.(null) == 0>"
这很奇怪,因为最后一行显示null约束。该UIView是视图控制器的超级视图。有人有同样的经历吗?
如您所见,它包含NSAutoresizingMaskLayoutConstraint
。尝试将translatesAutoresizingMaskIntoConstraints
设置为false
view.translatesAutoresizingMaskIntoConstraints = false