【iOS】Masonry 自动布局 MASViewConstraint.m:207 错误
问题详情:
Assertion failure in -[MASViewConstraint addConstraintWithLayoutAttribute:], ~/Pods/Masonry/Masonry/MASViewConstraint.m:207
报错原因:
make.right.equalTo([_imageView superview]).right.with.offset(-10); make.bottom.equalTo([_imageView superview]).bottom.with.offset(-10);
当时想当然的就这么写了,仔细查看了 Github 链接,才发现了自己的失误。正确写法如下:
make.right.equalTo([_imageView superview].mas_right).with.offset(-10); make.bottom.equalTo([_imageView superview].mas_bottom).with.offset(-10);
PS: 报此错误的的还可能是不小心把 with 误写成 width