[label1 mas_makeConstraints:^(MASConstraintMaker *make) {
//使左边间距为
make.left.equalTo(self.view.mas_left).offset(11);
//顶部间距
make.top.equalTo(self.view.mas_top).offset(70);
//高度
make.height.equalTo(30);
}];
[label2 mas_makeConstraints:^(MASConstraintMaker *make) {
//使宽高等于label1
make.width.and.height.equalTo(label1);
//与label1顶部对齐
make.top.equalTo(label1.mas_top);
//与label1的间距为0
make.leading.equalTo(label1.mas_trailing).offset(10);
}];
[label3 mas_makeConstraints:^(MASConstraintMaker *make) {
//使宽高等于label2
make.width.and.height.equalTo(label2);
//与label2顶部对齐
make.top.equalTo(label2.mas_top);
//与label2的间距为0
make.leading.equalTo(label2.mas_trailing).offset(10);
//与父视图右边约束
make.right.equalTo(self.view.mas_right).offset(-11);
}];
博客 http://ios.jobbole.com/83384/
时间: 2024-10-07 09:52:23