// // YOUPAIHRAgeSexView.m // VQU // // Created by xiaohaoran on 2021/11/19. // Copyright © 2021 MS. All rights reserved. // #import "YOUPAIHRAgeSexView.h" @interface YOUPAIHRAgeSexView () @property(nonatomic,strong)UIImageView *youpaipsexImageview; @property(nonatomic,strong)UILabel *youpaipageLabel; @property(nonatomic,strong)UIView *youpaipbgView; @end @implementation YOUPAIHRAgeSexView -(instancetype)initWithFrame:(CGRect)frame{ if (self = [super initWithFrame:frame]) { [self youpaifsetSubView]; } return self; } -(void)youpaifsetSubView{ //youpaipbgView UIView *youpaipbgView = [UIView new]; self.youpaipbgView = youpaipbgView; [self addSubview:youpaipbgView]; [youpaipbgView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_equalTo(0); }]; youpaipbgView.layer.cornerRadius = 7.5; youpaipbgView.clipsToBounds = YES; //性别 UIImageView *youpaipsexImageview = [UIImageView new]; self.youpaipsexImageview = youpaipsexImageview; [youpaipbgView addSubview:youpaipsexImageview]; [youpaipsexImageview mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(4); make.centerY.mas_equalTo(0); make.size.mas_equalTo(CGSizeMake(10, 10)); }]; //年龄 UILabel *youpaipageLabel = [UILabel new]; self.youpaipageLabel = youpaipageLabel; [youpaipbgView addSubview:youpaipageLabel]; [youpaipageLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(youpaipsexImageview.mas_right).offset(1); make.centerY.mas_equalTo(0); }]; youpaipageLabel.font = [UIFont systemFontOfSize:9]; } -(void)youpaifreloadWith:(NSInteger)Gender Age:(NSInteger)age{ if (Gender == 1) {//0未知 1女 2男 self.youpaipbgView.backgroundColor = HexColorFromRGBA(0xFF70CF, 0.09); self.youpaipsexImageview.image = [UIImage imageNamed:@"vqu_images_common_girl"]; self.youpaipageLabel.textColor = HexColorFromRGB(0xFF70CF); }else{ self.youpaipageLabel.textColor = HexColorFromRGB(0x70ADFF); self.youpaipbgView.backgroundColor = HexColorFromRGBA(0x70ADFF, 0.09); self.youpaipsexImageview.image = [UIImage imageNamed:@"vqu_images_common_boy"]; } self.youpaipageLabel.text = [NSString stringWithFormat:@"%ld",age]; } @end