Reputation: 8376
I have a custom UITableViewCell
set up using autolayout. However, when running the code, the following autolayout error appears:
"<NSLayoutConstraint:0x7fd6e3565900 UIImageView:0x7fd6e3566360.width == 0.833333*UIImageView:0x7fd6e3566360.height>",
"<NSLayoutConstraint:0x7fd6e3566290 V:|-(0)-[UIImageView:0x7fd6e3566360] (Names: '|':UIView:0x7fd6e3579050 )>",
"<NSLayoutConstraint:0x7fd6e3563e70 H:[UIImageView:0x7fd6e3566360]-(0)-| (Names: '|':UIView:0x7fd6e3579050 )>",
"<NSLayoutConstraint:0x7fd6e3563ec0 H:|-(0)-[UIImageView:0x7fd6e3566360] (Names: '|':UIView:0x7fd6e3579050 )>",
"<NSLayoutConstraint:0x7fd6e3564140 V:[UIImageView:0x7fd6e3566360]-(8)-[UILabel:0x7fd6e3565560'Hello']>",
"<NSLayoutConstraint:0x7fd6e35642d0 UIButton:0x7fd6e356b2a0.bottom == UIView:0x7fd6e3579050.bottom>",
"<NSLayoutConstraint:0x7fd6e3564320 V:[UILabel:0x7fd6e3565560'Hello']-(8)-[UIButton:0x7fd6e356b2a0]>",
"<NSLayoutConstraint:0x7fd6e35676d0 H:|-(5)-[UIView:0x7fd6e3579050] (Names: '|':UIView:0x7fd6e1de1370 )>",
"<NSLayoutConstraint:0x7fd6e3567720 V:|-(5)-[UIView:0x7fd6e3579050] (Names: '|':UIView:0x7fd6e1de1370 )>",
"<NSLayoutConstraint:0x7fd6e3567770 H:[UIView:0x7fd6e3579050]-(5)-| (Names: '|':UIView:0x7fd6e1de1370 )>",
"<NSLayoutConstraint:0x7fd6e35677c0 V:[UIView:0x7fd6e3579050]-(5)-| (Names: '|':UIView:0x7fd6e1de1370 )>",
"<NSLayoutConstraint:0x7fd6e3567980 V:|-(0)-[UIView:0x7fd6e1de1370] (Names: '|':UITableViewCellContentView:0x7fd6e3568fe0 )>",
"<NSLayoutConstraint:0x7fd6e35679d0 H:[UIView:0x7fd6e1de1370]-(0)-| (Names: '|':UITableViewCellContentView:0x7fd6e3568fe0 )>",
"<NSLayoutConstraint:0x7fd6e3567a20 V:[UIView:0x7fd6e1de1370]-(0)-| (Names: '|':UITableViewCellContentView:0x7fd6e3568fe0 )>",
"<NSLayoutConstraint:0x7fd6e3567a70 H:|-(0)-[UIView:0x7fd6e1de1370] (Names: '|':UITableViewCellContentView:0x7fd6e3568fe0 )>",
"<NSLayoutConstraint:0x7fd6e370c0b0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fd6e3568fe0(363.5)]>",
"<NSLayoutConstraint:0x7fd6e370c060 'UIView-Encapsulated-Layout-Width' H:[UITableViewCellContentView:0x7fd6e3568fe0(375)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fd6e3565900 UIImageView:0x7fd6e3566360.width == 0.833333*UIImageView:0x7fd6e3566360.height>
As you can see, it tries to break the 5:6 ratio I have set up for the UIImageView
(although there is no visible difference to what it's done on screen). I need to make sure this 5:6 ratio stays, however, I'm a little confused as to what it's conflicting with. Any help would be appreciated.
Upvotes: 0
Views: 1278
Reputation: 8376
Turns out I had to set the vertical constraints that were directly attached to the UIImageView
to be of slightly less priority than the aspect constraints of the UIImageView
.
Upvotes: 2