画面布局:SDAutoLayout、Masonry
Masonry :
简单例子:
self.viewTwo= [[UIViewalloc]init];
self.viewTwo.backgroundColor = UIColor.blueColor;
[self.viewTwo addSubview:self.viewTwo];
[self.viewTwo mas_makeConstraints:^(MASConstraintMaker *make){
make.top.equalTo(self.viewOne).offset(20);
make.left.equalTo(self.view).offset(20);
make.right.equalTo(self.view).offset(20);
make.height.equalTo(self.view).offset(70);
}];
SDAutoLayout :
简单例子:
self.viewFour= [[UIView alloc] Init];
self.viewFour.backgroundColor = UIColor.blackColor;
[self.viewFour addSubview:self.viewFour];
self.viewFour.sd_layout.leftEqualToView(self.viewThree).rightEqualToView(self.viewThree).topSpaceToView(self.viewThree, 30).heightIs(50);
Masonry 的详细使用
转载链接:https://zhuanlan.zhihu.com/p/396529672
SDAutoLayout 的详细使用
网友评论