手动代码约束,等比例

[redView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view.mas_left).offset(0);//使左边等于self.view的左边,间距为0
make.top.equalTo(self.view.mas_top).offset(0);//使顶部与self.view的间距为0
make.width.equalTo(self.view.mas_width).multipliedBy(0.5);//设置宽度为self.view的一半,multipliedBy是倍数的意思,也就是,使宽度等于self.view宽度的0.5倍
make.height.equalTo(self.view.mas_height).multipliedBy(0.5);//设置高度为self.view高度的一半

}];
原文链接:http://www.jianshu.com/p/10a250cc5018

原文地址:https://www.cnblogs.com/ios988/p/5422739.html