在使用第三方庫ZLSwipeableView的時(shí)候雹食,在定義的card view的時(shí)候使用的是Masonry來自動布局畜普,結(jié)果就發(fā)現(xiàn),對每一個(gè)定義在card view內(nèi)部群叶,使用Marsonry布局的空間吃挑,都出現(xiàn)了如下的警告:
[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.
(
"<MASLayoutConstraint:0x6080000bd8e0 UILabel:0x7fabebd48250.width == 199>",
"<MASLayoutConstraint:0x6000002a8b80 UILabel:0x7fabebd48250.width == 208.687>"
)
Will attempt to recover by breaking constraint
<MASLayoutConstraint:0x6000002a8b80 UILabel:0x7fabebd48250.width == 208.687>
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.
找了很久,都沒有找到第二個(gè)約束是在哪里設(shè)置的盖呼,如果有人知道的話儒鹿,請留言指教。
至于解決方案几晤,就是對card view內(nèi)部使用Masonry布局的空間添加布局優(yōu)先級约炎,就可以移除這些警告了。
例如:
[self.backgroundImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
修改為:
[self.backgroundImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self).priorityHigh();
}];