AutoLayout用 Masonry加属性写在什么地方
作者:
呆木大人 | 来源:发表于
2017-03-30 09:52 被阅读30次
一般我是这么做的,
如果是在ViewController里面写,就直接卸载viewdidload里面
如果是在view里
-(void)updateConstraints
{
[super updateConstraints];
WeakObj(self);
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(@0);
make.top.equalTo(@0);
make.bottom.equalTo(@0);
make.right.equalTo(@0);
}];
[self.upLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(selfWeak.mas_centerY).multipliedBy(0.6);
make.centerX.equalTo(selfWeak.mas_centerX);
}];
[self.downLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(selfWeak.mas_centerX);
make.centerY.equalTo(selfWeak.mas_centerY).multipliedBy(1.4);
}];
}
本文标题:AutoLayout用 Masonry加属性写在什么地方
本文链接:https://www.haomeiwen.com/subject/eqeuottx.html
网友评论