Masonry小结
一,容易混淆的问题
1.make.left.equal(xxx)的参数若为某个控件,则默认为以该控件的 left 为基准对照.
1 //these two constraints are exactly the same 2 3 make.left.greaterThanOrEqualTo(label); 4 make.left.greaterThanOrEqualTo(label.mas_left);
2.宽度/高度可以使用常亮值, left/right/top/bottom/centerY/centerX 也可以用,但是代表的是相对位置.
1 //width >= 200 && width <= 400 2 make.width.greaterThanOrEqualTo(@200); 3 make.width.lessThanOrEqualTo(@400) 4 5 //creates view.left = view.superview.left + 10 6 make.left.lessThanOrEqualTo(@10) 7 make.left.lessThanOrEqualTo(10)
3.设置边距
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 [self.webView mas_makeConstraints:^(MASConstraintMaker *make) { 2 make.edges.equalTo(self); 3 }];
4.