【发布时间】:2018-12-05 16:48:05
【问题描述】:
我在故事板中定义了一个 UIStackView,第一个按钮的高度设置为 70,另一个设置为 45。我收到此自动布局错误:
[LayoutConstraints] 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:0x280f614f0 UIButton:0x10641a120.height == 45 (active)>",
"<NSLayoutConstraint:0x280f60e60 UIButton:0x106418f80.height == 70 (active)>",
"<NSLayoutConstraint:0x280f604b0 'UISV-alignment' UIButton:0x10641a120.bottom == UIButton:0x106418f80.bottom (active)>",
"<NSLayoutConstraint:0x280f63cf0 'UISV-alignment' UIButton:0x10641a120.top == UIButton:0x106418f80.top (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x280f60e60 UIButton:0x106418f80.height == 70 (active)>
我了解 UIStackView 无法接受不同高度的 UIButton,这是正确的吗?让 UIStackView 接受其元素的不同高度或宽度的方法是什么?
【问题讨论】:
标签: ios autolayout uikit nslayoutconstraint uistackview