forkingdog / UITableView-FDTemplateLayoutCell

Template auto layout cell for automatically UITableViewCell height calculating
MIT License
9.93k stars 2.01k forks source link

Unable to simultaneously satisfy constraints #326

Open webMing opened 7 years ago

webMing commented 7 years ago

环境:iPhone SE , iOS 10.2 , [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:0x17428b130 UITableViewCellContentView:0x137ef04a0.width == 320>", "<NSLayoutConstraint:0x17028f2d0 UITableViewCellContentView:0x137ef04a0.width == 0>" )

Will attempt to recover by breaking constraint <NSLayoutConstraint:0x17428b130 UITableViewCellContentView:0x137ef04a0.width == 320>

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.

有遇到这种问题的吗?

sensencoder commented 7 years ago

有,不知道如何解决

webMing commented 7 years ago

看微博简介说 会默认添加UITableViewCellContentViewWidth 的约束,不知道怎么去掉

luo-h commented 7 years ago

你的控件是不是直接添加到cell上的,改成cell.contentView试试

webMing commented 7 years ago

用的是xib. 约束是添加到contentView上面的

webMing commented 7 years ago

我用的xib,有时间看代码再讨论。