Masonry
Masonry常用的属性和方法
例:
UILabel* lable = [[UILabel alloc]init];
[self.view addSubview:lable];
lable.backgroundColor = [UIColor redColor];
[lable mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view.mas_top).offset(10);
make.bottom.equalTo(self.view.mas_bottom).offset(-10);
make.left.equalTo(self.view.mas_left).offset(10);
make.right.equalTo(self.view.mas_right).offset(-10);
}];
UILabel* lable2 = [[UILabel alloc]init];
[lable addSubview:lable2];
lable2.backgroundColor = [UIColor grayColor];
[lable2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(lable.mas_top).offset(10);
make.left.equalTo(lable.mas_left).offset(10);
make.width.mas_equalTo(100);
make.height.mas_equalTo(100);
}];
1.Masonry的常见方法:mas_makeConstraints:<#^(MASConstraintMaker *make)block#>
2.Masonry的常见属性:
1):top/mas_top 顶部
2):bottom/mas_bottom 底部
3):left/mas_left 左边
4):right/mas_right 右边
5):width 宽
6):height 高
之意事项
1).一定要先加到父识图,在进行Masonry的方法
2).Masonry只会向右和向下计算 , 所以在以参照物向左和向上时用负值
以上,是我目前的总结