Ios8 打破tableHeaderView中的约束

Ios8 打破tableHeaderView中的约束,ios8,autolayout,constraints,Ios8,Autolayout,Constraints,我已将UILabel导入UIView xib。我的tableView在tableHeaderView中包含该视图。 标签具有以下约束: 在运行时,我在控制台中得到下一个警告: 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 eac

我已将UILabel导入UIView xib。我的tableView在tableHeaderView中包含该视图。 标签具有以下约束:

在运行时,我在控制台中得到下一个警告:

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:0x7feaf3969800 H:|-(77)-[UILabel:0x7feaf3968e00'ThreeWithLngNameVeryLong ...']   (Names: '|':HeaderView:0x7feaf3968040 )>",
    "<NSLayoutConstraint:0x7feaf39698a0 H:[UILabel:0x7feaf3968e00'ThreeWithLngNameVeryLong ...']-(16)-|   (Names: '|':HeaderView:0x7feaf3968040 )>",
    "<NSLayoutConstraint:0x7feaf397b4d0 'UIView-Encapsulated-Layout-Width' H:[HeaderView:0x7feaf3968040(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7feaf39698a0 H:[UILabel:0x7feaf3968e00'ThreeWithLngNameVeryLong ...']-(16)-|   (Names: '|':HeaderView:0x7feaf3968040 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
无法同时满足约束。
可能下面列表中至少有一个约束是您不想要的。试着这样做:(1)看看每个约束,试着找出你不期望的约束;(2) 找到添加了不需要的约束的代码,然后修复它。(注意:如果您看到不理解的NSAutoresizingMaskLayoutConstraints,请参阅UIView属性TranslatesAutoResizingMaskToConstraints的文档)
(
"",
"",
""
)
将尝试通过打破约束进行恢复
在UIViewAlertForUnsatifiableConstraints处创建一个符号断点,以便在调试器中捕获该断点。
中列出的UIView上UIConstraintBasedLayoutDebugging类别中的方法也可能会有所帮助。

也许有人知道出了什么问题?

正如我在这里看到的,您在superview上设置了尾随和前导基。 但是你也设置了宽度,我不知道这里的头视图是什么。 但是标题的宽度可能与标签的约束有关,因此它们是冲突的


尝试删除页眉宽度约束以检查是否已解决

是,它们是冲突的。但问题是它们为什么会冲突?”因为在iOS 8中,我们不需要设置标签的宽度。我们更喜欢使用“自动”宽度,并且在大多数情况下也能正常工作。(在iOS 7中,我们需要为该属性设置宽度值)。但是,由于某些原因,当我们将UIView放入tableHeaderView时,它不起作用。