XCode:为什么NSLayoutConstraint被添加到我的代码中?

时间:2018-04-06 13:23:20

标签: xcode nslayoutconstraint

我有这个xib:

enter image description here

我有这些限制:

enter image description here

superview上的所有约束都有一个0的常数和1的乘数。当我运行我的应用程序时,我在日志中得到了这个抱怨:

[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:0x60800028a7d0 UIView:0x7fcde1628e60.leading == UIButton:0x7fcde1629400.trailing>",
    "<NSLayoutConstraint:0x60800028a8c0 UIView:0x7fcde1629040.leading == UIView:0x7fcde1628e60.leading + 50>",
    "<NSLayoutConstraint:0x60800028a910 UIView:0x7fcde1629040.leading == UIButton:0x7fcde1629400.trailing>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x60800028a910 UIView:0x7fcde1629040.leading == UIButton:0x7fcde1629400.trailing>

第二个,将视图的前导设置为superview + 50的前导。我从未做过那个约束。 XCode是否添加了它?另外,为什么它会复制leading = button尾随约束?

0 个答案:

没有答案