autolayout异常解决

来源:互联网 发布:海岛骑兵医师升级数据 编辑:程序博客网 时间:2024/06/06 10:05

 [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:0x17068b630 UIButton:0x153b67fe0.right == UITableViewCellContentView:0x153b682a0.right - 2   (active)>",

    "<NSLayoutConstraint:0x17068b3b0 H:|-(372)-[UIButton:0x153b67fe0](LTR)   (active, names: '|':UITableViewCellContentView:0x153b682a0 )>",

    "<NSLayoutConstraint:0x17068bf90 'UIView-Encapsulated-Layout-Width' UITableViewCellContentView:0x153b682a0.width == 320   (active)>"

)


Will attempt to recover by breaking constraint 

<NSLayoutConstraint:0x17068b630 UIButton:0x153b67fe0.right == UITableViewCellContentView:0x153b682a0.right - 2   (active)>


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)打symbolic breakpoint

(2)将UIViewAlertForUnsatisfiableConstraints放入位置

这样能找到异常的准确的位置




原创粉丝点击