The white view has two sub-view, Red View and orange view. The width of the white view is equal to the larger of the Orange view and the red view width, and the orange view and the Red view are centered vertically,
The masonry layout is as follows:
[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 (ten); Make.bottom.equalTo (Baseview); Make.centerX.equalTo (baseview); Make.width.lessThanOrEqualTo (Self.btnTitleView.superview); }];
The width of the iOS parent view is equal to the width of the larger view, and is centered vertically