利用masonry实现如下图的布局格式:
实现代码如下:
1 //设置约束 2 - (void)setTheConstraintForProgress { 3 //开始 4 [self.startBtn mas_makeConstraints:^(MASConstraintMaker *make) { 5 make.top.equalTo(self.view.mas_top).offset(150); 6 make.left.equalTo(self.view.mas_left).offset(kMargin); 7 make.height.mas_equalTo(39); 8 }]; 9 //暂停 10 [self.pauseBtn mas_makeConstraints:^(MASConstraintMaker *make) { 11 make.top.width.height.equalTo(self.startBtn); 12 make.left.equalTo(self.startBtn.mas_right).offset(kMargin); 13 make.right.equalTo(self.continueBtn.mas_left).offset(-kMargin); 14 }]; 15 //继续 16 [self.continueBtn mas_makeConstraints:^(MASConstraintMaker *make) { 17 make.top.width.height.equalTo(self.startBtn); 18 make.left.equalTo(self.pauseBtn.mas_right).offset(kMargin); 19 make.right.equalTo(self.againBtn.mas_left).offset(-kMargin); 20 }]; 21 //重新 22 [self.againBtn mas_makeConstraints:^(MASConstraintMaker *make) { 23 make.top.width.height.equalTo(self.startBtn); 24 make.right.equalTo(self.view.mas_right).offset(-kMargin); 25 }]; 26 }