我有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.
也许有人知道出了什么问题?
答案 0 :(得分:0)
正如我在这里看到的,你在superview上设置了Trailing和Leading base。 但你也设置了宽度,我不知道这里的HeaderView是什么。 但是标题的宽度可能与标签的约束有关,因此它们是冲突的。
尝试删除标题宽度约束以检查它是否已解决