Ios 无法同时满足单个约束
我有一个奇怪的案例——我会尝试隔离,但我想在此期间我会提出一个问题。我有一个具有高度约束的UILabel。当我尝试将高度设置为0时,会出现以下错误:Ios 无法同时满足单个约束,ios,objective-c,autolayout,Ios,Objective C,Autolayout,我有一个奇怪的案例——我会尝试隔离,但我想在此期间我会提出一个问题。我有一个具有高度约束的UILabel。当我尝试将高度设置为0时,会出现以下错误: 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 a
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. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x7b9b5d90 V:[UILabel:0x7b9c6cf0(0)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7b9b5d90 V:[UILabel:0x7b9c6cf0(0)]>
Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
让我感到困惑的是,错误表示无法同时满足约束,但只显示一个约束。它还可以通过打破单一约束进行恢复
约束如何与自身冲突?如何设置此约束?我有一个指向在IB中创建的约束的IBOutlet,并且我在IBOutlet属性上设置了常量属性。对于从nib加载的UIView上的宽度约束,我也有相同的问题,约束是在代码中创建的。发帖后你发现了什么吗?我不相信我找到了答案,我必须从头开始重新设计,我知道UILabel有自己的布局,所以可能与基于文本的自动调整有关?