AutoLayout用 Masonry加属性写在什么地方

一般我是这么做的,

如果是在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加属性写在什么地方)