前提:本项目用的开源库 Masonry,部分控件不全时用代码进行的约束。像下面的UIView控件tabBar‘
导入了Masonry.h头文件。
代码在开发时就把底部的UIView控件tabBar的约束在autoLayout布局里写死了,将其高度定义为100.
不过后来要适应iPAD,需要把其高度设为300 ,因为要用代码写所以导入Masonry.h头文件,判断当是ipad时,用mas_updateConstraints block语法进行高度的更新 代码如下:
[tabBar mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(300);
}];
可是在控制台输出如下:
“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. (Note: If you’re seeing NSAutoresizingMaskLayoutConstraints that you don’t understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
“<NSLayoutConstraint:0x145d0260 UIView:0x145cf040.height == 100>”,
“<MASLayoutConstraint:0x14562080 UIView:0x145cf040.height == 300>”
)
Will attempt to recover by breaking constraint
<MASLayoutConstraint:0x14562080 UIView:0x145cf040.height == 300>
Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.”
clean项目后再运行,控制台还是这样的日志。
接着我又分别用了mas_makeConstraints,mas_remakeConstraints来设置其高度,clean项目后控制台的日志依旧是这样的。很不解。
还望各位前辈指教。非常感谢。