Masonry使用小结

Masonry使用小结:
1、equalTo:用于跟对象约束;
2、mas_equalTo:用于具体的数值;
3、没有offset():默认约束距离是零;

[self.okButton mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(self.view);//顶部
    make.width.mas_equalTo(300);
    make.height.mas_equalTo(160);
    make.trailing.equalTo(self.view);//右边
}];
[ImageView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(self.view).offset(16);//偏移16
    make.size.mas_equalTo(CGSizeMake(64,64));
    make.centerX.equalTo(self.view);//垂直居中
}];
[self.cancelButton mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(self.holderView);
    make.leading.equalTo(self.holderView);
    make.bottom.equalTo(self.pickerView.mas_top);//底部跟顶部
    make.width.mas_equalTo(kButtonWidth);
}];

你可能感兴趣的:(Masonry使用小结)