白色view上面有两个子View,红色view和橙色view。白色view的宽度等于橙色view和红色view宽度较大的一个,并且橙色view和红色view垂直居中,
Masonry布局如下:
[self.btnImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(baseView);
make.width.equalTo(@(buttonConfig.indexPic.width));
make.height.equalTo(@(buttonConfig.indexPic.height));
make.centerX.equalTo(baseView);
make.width.lessThanOrEqualTo(self.btnImageView.superview);
}]; [self.btnTitleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.btnImageView.mas_bottom).offset();
make.bottom.equalTo(baseView);
make.centerX.equalTo(baseView);
make.width.lessThanOrEqualTo(self.btnTitleView.superview);
}];