iOS集合

使用Masonry时出现 [LayoutConstraints

2022-01-05  本文已影响0人  一代枭雄

使用Masonry时出现

[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. 

至于解决方案,就是对view内部使用Masonry布局的空间添加布局优先级,就可以移除这些警告了。

例如:

[self.backgroundImageView mas_makeConstraints:^(MASConstraintMaker*make){make.edges.equalTo(self);}];

修改为:

[self.backgroundImageView mas_makeConstraints:^(MASConstraintMaker*make){make.edges.equalTo(self).priorityHigh();}];

上一篇下一篇

猜你喜欢

热点阅读