冲突的AutoLayout约束?

时间:2015-06-18 23:23:34

标签: ios objective-c swift

运行我的代码我收到以下错误:

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) 
(
    "<_UIScrollViewAutomaticContentSizeConstraint:0x7a09e6a0 UITableView:0x7c1d4400.contentHeight{id: 178} == -5.000000>"
)

Will attempt to recover by breaking constraint 
<_UIScrollViewAutomaticContentSizeConstraint:0x7a09e6a0 UITableView:0x7c1d4400.contentHeight{id: 178} == -5.000000>

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.

如何找到此问题的根源?

1 个答案:

答案 0 :(得分:0)

您只需向tableview添加额外约束,删除不需要添加tableview的约束。它会在 contentHeight 中显示问题。只需删除contentHeight并在那里添加适当的约束。

相关问题