iOS 使用Masonry出现约束警告问题

在使用Masonry时候,有时候虽然界面显示正常,但是log里面会出现如下类似的警告。


一.问题描述:

[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. 

[

,

,

]

Will attempt to recover by breaking constraint 

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.

The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in may also be helpful.

1

二. 解决方法:

1.通过断点找到有问题的控件XX

2. 初始化控件XX 下面 添加 代码   MASAttachKeys(控件XX)

2

3.run,看log

3

一目了然就可以看到有问题的约束,修改即可。

你可能感兴趣的:(iOS 使用Masonry出现约束警告问题)