iOS swift tableview滑动的时候cell总是报约束错误

  • 看下面的报错都是和X方向的约束有个,可能是和自动行高相关的问题
 [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. 
(
    "<SnapKit.LayoutConstraint:[email protected]#169 UIButton:0x7f9f306527a0.height == 35.0>",
    "<SnapKit.LayoutConstraint:[email protected]#170 UIButton:0x7f9f306527a0.top == UITableViewCellContentView:0x7f9f306558c0.top + 10.0>",
    "<SnapKit.LayoutConstraint:[email protected]#196 UILabel:0x7f9f3066df00.top == UIButton:0x7f9f306527a0.bottom + 15.0>",
    "<SnapKit.LayoutConstraint:[email protected]#203 UIView:0x7f9f3065d350.top == UILabel:0x7f9f3066df00.bottom + 10.0>",
    "<SnapKit.LayoutConstraint:[email protected]#103 UIButton:0x7f9f3045cf90.top == UIView:0x7f9f3065d350.top + 99.0>",
    "<SnapKit.LayoutConstraint:[email protected]#105 UIButton:0x7f9f3045cf90.height == 91.0>",
    "<SnapKit.LayoutConstraint:[email protected]#108 UIButton:0x7f9f3045cf90.bottom == UIView:0x7f9f3065d350.bottom - 10.0>",
    "<SnapKit.LayoutConstraint:[email protected]#227 UIButton:0x7f9f3070f1c0.height == 25.0>",
    "<SnapKit.LayoutConstraint:[email protected]#226 UIButton:0x7f9f3070f1c0.top == UIView:0x7f9f3065d350.bottom>",
    "<SnapKit.LayoutConstraint:[email protected]#229 UIButton:0x7f9f3070f1c0.bottom == UITableViewCellContentView:0x7f9f306558c0.bottom - 23.0>",
    "<NSLayoutConstraint:0x6000029cc910 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7f9f306558c0.height == 240.5   (active)>"
)

Will attempt to recover by breaking constraint 
<SnapKit.LayoutConstraint:[email protected]#105 UIButton:0x7f9f3045cf90.height == 91.0>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

猜你喜欢

转载自blog.csdn.net/baidu_40537062/article/details/123724139