I have a tableview cell with an imageview and a button inside it. I add constraints for imageview and button. The tableview appears and the cell is displayed correctly. But when reuse the cell, I scroll down the tableView and scroll back up, cells are displayed wrong?
When I reuse the cell I add new constraints, there are conflicts with earlier constraints,I try to delete earlier constraints before adding new constraints but it does not work. Here is the project link:
https://github.com/chengyanan/chat
console throw warnings in case of autolayout errors:
2015-12-10 16:34:30.299 Chat[5488:133086] 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:0x7cc5b120 H:[UIImageView:0x7c94daa0(30)]>",
"<NSLayoutConstraint:0x7cc5a640 H:|-(8)-[UIImageView:0x7c94daa0](LTR) (Names: '|':UITableViewCellContentView:0x7c96bdb0 )>",
"<NSLayoutConstraint:0x7ccab9e0 UIImageView:0x7c94daa0.right == UITableViewCellContentView:0x7c96bdb0.right - 8>",
"<NSLayoutConstraint:0x7cc71dc0 'UIView-Encapsulated-Layout-Width' H:[UITableViewCellContentView:0x7c96bdb0(320)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7ccab9e0 UIImageView:0x7c94daa0.right == UITableViewCellContentView:0x7c96bdb0.right - 8>
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.
2015-12-10 16:34:30.300 Chat[5488:133086] 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:0x7cc5b120 H:[UIImageView:0x7c94daa0(30)]>",
"<NSLayoutConstraint:0x7cc59d40 H:[UIImageView:0x7c94daa0]-(3)-[UIButton:0x7c95b8b0'Trgghhh hhhhhhhhhhhbbbbbv...'](LTR)>",
"<NSLayoutConstraint:0x7cc78640 H:[UIButton:0x7c95b8b0'Trgghhh hhhhhhhhhhhbbbbbv...'(255)]>",
"<NSLayoutConstraint:0x7ccc99f0 UIButton:0x7c95b8b0'Trgghhh hhhhhhhhhhhbbbbbv...'.right == UIImageView:0x7c94daa0.left - 3>"
)