When I use masonry to auto layout my UI, but often show this error ,sometimes the UI display ok, other the UI display error
gdxud2016 opened this issue Β· comments
New Issue Checklist
π« If this template is not filled out your issue will be closed with no comment. π«
- I have looked at the Documentation
- I have filled out this issue template.
Issue Info
Info | Value |
---|---|
Platform | e.g. ios/osx/tvos |
Platform Version | e.g. 8.0 |
Masonry Version | e.g. 1.0 |
Integration Method | e.g. carthage/cocoapods/manually |
Issue Description
this my iOS code, can you help me resolve this question!
[_userIconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.equalTo(self.contentView).offset(leftmargin);
make.width.height.offset(76);
}];
[_userNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(_userIconImageView.mas_top);
make.left.equalTo(_userIconImageView.mas_right).offset(leftmargin);
make.right.equalTo(self.contentView.mas_right).offset(-10);
}];
[_userCompanyNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(_userIconImageView.mas_bottom);
make.left.right.equalTo(_userNameLabel);
}];
[_companyScoreLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(_userCompanyNameLabel.mas_bottom).offset(leftmargin);
make.left.equalTo(self.contentView.mas_left).offset(leftmargin);
make.bottom.equalTo(self.contentView.mas_bottom).offset(-rightmargin);
}];
[_personalScoreLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(_companyScoreLabel.mas_top);
make.left.equalTo(_companyScoreLabel.mas_right);
make.right.equalTo(self.contentView.mas_right).offset(-rightmargin);
make.width.equalTo(_companyScoreLabel);
}];
error log:
"<MASLayoutConstraint:0x6000017d91a0 UIImageView:0x7f9ee95034e0.top == UITableViewCellContentView:0x7f9ee952e340.top + 16>",
"<MASLayoutConstraint:0x6000017da700 UIImageView:0x7f9ee95034e0.height == 76>",
"<MASLayoutConstraint:0x6000017d8fc0 UILabel:0x7f9ee95015d0.bottom == UIImageView:0x7f9ee95034e0.bottom>",
"<MASLayoutConstraint:0x6000017d9e60 UILabel:0x7f9ee9527c90.top == UILabel:0x7f9ee95015d0.bottom + 16>",
"<MASLayoutConstraint:0x6000017db4e0 UILabel:0x7f9ee9527c90.bottom == UITableViewCellContentView:0x7f9ee952e340.bottom - 16>",
"<NSLayoutConstraint:0x6000010e0780 UITableViewCellContentView:0x7f9ee952e340.height == 107.5>"
)
Will attempt to recover by breaking constraint
<MASLayoutConstraint:0x6000017da700 UIImageView:0x7f9ee95034e0.height == 76>