我注意到方向改变了werid break约束。我有几个视图的堆栈 - 纵向位置的堆栈有distribution = .fill
和axis = .vertical
,而方向将在willTransition
内部发生变化对于横向我正在更改distribution = fillEqually
和{{ 1}}。在我停用约束时,约束中断。
axis = .horizontal
我知道Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x1c0096670 UIStackView:0x103d50f70.height == 168.75 (active)>",
"<NSLayoutConstraint:0x1c0096cb0 UICollectionView:0x1048b3e00.height == 40.02 (active)>",
"<NSLayoutConstraint:0x1c0095e00 'UISV-alignment' UIStackView:0x103d42150.bottom == UICollectionView:0x1048b3e00.bottom (active)>",
"<NSLayoutConstraint:0x1c0095cc0 'UISV-alignment' UIStackView:0x103d42150.top == UICollectionView:0x1048b3e00.top (active)>",
"<NSLayoutConstraint:0x1c009d420 'UISV-canvas-connection' UIStackView:0x103d50f70.top == UIStackView:0x103d42150.top (active)>",
"<NSLayoutConstraint:0x1c00967b0 'UISV-canvas-connection' V:[UIStackView:0x103d42150]-(0)-| (active, names: '|':UIStackView:0x103d50f70 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1c0096cb0 UICollectionView:0x1048b3e00.height == 40.02 (active)>
的高度限制正在破坏,但为什么呢?当我停用它时,它为什么会断裂?
这是一段代码:
UICollectionView
我能错过什么?提前谢谢!