// // YOUPAISelectSexView.m // MSYOUPAI // // Created by admin on 2022/3/8. // Copyright © 2022 MS. All rights reserved. // #import "YOUPAISelectSexView.h" @implementation YOUPAISelectSexView -(instancetype)initWithFrame:(CGRect)frame{ if(self == [super initWithFrame:frame]){ [self youpaifMakeUI]; [self youpaifMakelayout]; } return self; } -(UIButton *)youpaipmanBtn{ if(_youpaipmanBtn == nil){ _youpaipmanBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 154, 56)]; [_youpaipmanBtn ms_radius:28]; [_youpaipmanBtn setTitle:@"男生" forState:UIControlStateNormal]; [_youpaipmanBtn setImage:[UIImage imageNamed:@"icon_man"] forState:UIControlStateNormal]; _youpaipmanBtn.backgroundColor = LZ1DBEF9Color; [_youpaipmanBtn setTitleColor:UIColor.whiteColor forState:UIControlStateSelected]; [_youpaipmanBtn setTitleColor:LZ273145Color forState:UIControlStateNormal]; } return _youpaipmanBtn; } -(UIButton *)youpaipwomanBtn{ if(_youpaipwomanBtn == nil){ _youpaipwomanBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 154, 56)]; [_youpaipwomanBtn ms_radius:28]; [_youpaipwomanBtn setTitle:@"女生" forState:UIControlStateNormal]; [_youpaipwomanBtn setTitleColor:UIColor.whiteColor forState:UIControlStateSelected]; [_youpaipwomanBtn setTitleColor:LZ273145Color forState:UIControlStateNormal]; [_youpaipwomanBtn setImage:[UIImage imageNamed:@"icon_woman"] forState:UIControlStateNormal]; _youpaipwomanBtn.backgroundColor = LZF5F4F7Color; } return _youpaipwomanBtn; } -(UILabel *)youpaipremarkLab{ if(_youpaipremarkLab == nil){ _youpaipremarkLab = [UILabel new]; _youpaipremarkLab.textColor = LZD3D1D7Color; _youpaipremarkLab.font = LCFont12; _youpaipremarkLab.text = @"性别选择后不可修改"; } return _youpaipremarkLab; } -(UIImageView *)youpaipLeftLine{ if(_youpaipLeftLine == nil){ _youpaipLeftLine = [UIImageView new]; _youpaipLeftLine.image = [UIImage imageNamed:@"icon_line"]; } return _youpaipLeftLine; } -(UIImageView *)youpaipRightLine { if(_youpaipRightLine == nil){ _youpaipRightLine = [UIImageView new]; _youpaipRightLine.image = [UIImage imageNamed:@"icon_line"]; } return _youpaipRightLine; } -(void)youpaifMakeUI{ [self addSubview:self.youpaipmanBtn]; [self addSubview:self.youpaipwomanBtn]; [self addSubview:self.youpaipLeftLine]; [self addSubview:self.youpaipRightLine]; [self addSubview:self.youpaipremarkLab]; } -(void)youpaifMakelayout{ [_youpaipmanBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(self.mas_centerX).offset(-6); make.top.offset(0); make.size.mas_equalTo(CGSizeMake(154, 56)); }]; [_youpaipwomanBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.mas_centerX).offset(6); make.top.offset(0); make.size.mas_equalTo(CGSizeMake(154, 56)); }]; [_youpaipremarkLab mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.offset(0); make.top.mas_equalTo(self.youpaipmanBtn.mas_bottom).offset(16); }]; [_youpaipRightLine mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.youpaipremarkLab.mas_right).offset(10); make.centerY.mas_equalTo(self.youpaipremarkLab); }]; [_youpaipLeftLine mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(self.youpaipremarkLab.mas_left).offset(-10); make.centerY.mas_equalTo(self.youpaipremarkLab); }]; } @end