天天看点

Masonry 部分属性说明

mas_makeConstraints:添加约束

mas_updateConstraints:更新约束、亦可添加新约束

mas_remakeConstraints:重置之前的约束

equalTo   =>   NSLayoutRelationEqual   等于

lessThanOrEqualTo    =>  NSLayoutRelationLessThanOrEqual   小于或等于

greaterThanOrEqualTo  =>  NSLayoutRelationGreaterThanOrEqual  大于或等于 

.priorityHigh   =>  UILayoutPriorityDefaultHigh     高优先级

.priorityMedium  =>  between high and low        介于高/低之间

.priorityLow => UILayoutPriorityDefaultLow   低优先级 

.multipliedBy属性表示约束值为约束对象的乘因数

.dividedBy属性表示约束值为约束对象的除因数,

可用于设置view的宽高比  相对于指定View的比例 

        make.height.equalTo(self.mas_height).with.multipliedBy(2);   // 高度等于当前view总高度的2倍

        make.width.equalTo(self.mas_width).with.dividedBy(2);    //宽度等于当前view总宽度的一半

       make.width.equalTo(self.mas_width).with.multipliedBy(0.5);   //宽度等于当前view总宽度的一半

.mas_baseline是view的底部距离顶部的距离  **注意参照点是顶部**