// // YOUPAIZYAsylumListCell.m // VQU // // Created by Elaine on 2020/10/10. // Copyright © 2020 leo. All rights reserved. // #import "YOUPAIZYAsylumListCell.h" @interface YOUPAIZYAsylumListCell() @property(nonatomic,strong)UIImageView *youpaipheaderImgView; @property(nonatomic,strong)UILabel *youpaipnameLabel; @property(nonatomic,strong)UILabel *youpaiptimeLabel; @property (nonatomic,strong)UILabel *youpaipnumL; @property (nonatomic,strong)UIImageView *youpaipvipV; @property (nonatomic,strong) UIImageView *youpaipsexImgV; /// 性别 @property (nonatomic,strong) UIImageView *youpaipanchorTagImgV; // 女神标记 @end @implementation YOUPAIZYAsylumListCell -(void)youpaifsetupUI { self.selectionStyle = UITableViewCellSelectionStyleNone; [self setBackgroundColor:[UIColor clearColor]]; UILabel *numL = [[UILabel alloc]init]; [numL setTextColor:[UIColor whiteColor]]; numL.font = LCFont14; [self.contentView addSubview:numL]; self.youpaipnumL = numL; [numL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(14.0f); make.centerY.equalTo(self.contentView.mas_centerY); }]; _youpaipheaderImgView = [[UIImageView alloc] init]; _youpaipheaderImgView.layer.cornerRadius = 20; _youpaipheaderImgView.layer.masksToBounds = YES; _youpaipheaderImgView.contentMode = UIViewContentModeScaleAspectFill; [self.contentView addSubview:_youpaipheaderImgView]; [_youpaipheaderImgView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(34.0f); make.centerY.equalTo(self.contentView.mas_centerY); make.size.mas_offset(CGSizeMake(40.0f, 40.0f)); }]; UIImageView *anchorTagImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_anchor_vlog"]]; anchorTagImgV.hidden = YES; [self addSubview:anchorTagImgV]; self.youpaipanchorTagImgV = anchorTagImgV; [anchorTagImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.youpaipheaderImgView.mas_right).offset(0.0f); make.bottom.equalTo(self.youpaipheaderImgView.mas_bottom).offset(0.0f); make.size.mas_offset(CGSizeMake(10.0f, 10.0f)); }]; _youpaipnameLabel = [[UILabel alloc]init]; [_youpaipnameLabel setTextColor:[UIColor whiteColor]]; _youpaipnameLabel.font = LCFont16; [self.contentView addSubview:_youpaipnameLabel]; [_youpaipnameLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.youpaipheaderImgView.mas_right).offset(8.0f); make.centerY.equalTo(self.contentView.mas_centerY); }]; UIImageView *sexImgV = [[UIImageView alloc] init]; [sexImgV setImage:[UIImage imageNamed:@"vqu_images_D_dynamic_woman"]]; [self.contentView addSubview:sexImgV]; self.youpaipsexImgV = sexImgV; [sexImgV makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.youpaipnameLabel.right).offset(@5); make.centerY.equalTo(self.youpaipnameLabel); make.size.mas_equalTo(CGSizeMake(14, 14)); }]; UIImageView *vipV = [[UIImageView alloc] init]; [self.contentView addSubview:vipV]; self.youpaipvipV = vipV; [vipV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(sexImgV.mas_right).offset(5.0f); make.centerY.equalTo(sexImgV); make.size.mas_offset(CGSizeMake(30.0f, 19.0f)); }]; _youpaiptimeLabel = [[UILabel alloc]init]; [_youpaiptimeLabel setTextColor:HexColorFromRGB(0xFF9696)]; _youpaiptimeLabel.font = [UIFont systemFontOfSize:12]; _youpaiptimeLabel.textAlignment = NSTextAlignmentRight; [self.contentView addSubview:_youpaiptimeLabel]; [_youpaiptimeLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.right.offset(-14.0f); make.centerY.equalTo(self.contentView.mas_centerY); }]; [self.contentView addLineWithColor:HexColorFromRGB(0x28262D) lineRect:CGRectMake(14.0f, 69.5f, KScreenWidth - 28.0f, 0.5f)]; } -(void)setYoupaipmodel:(YOUPAIZYAsylumListModel *)model { [_youpaipheaderImgView sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipavatar]]; _youpaipnameLabel.text = model.youpaipnickname; _youpaiptimeLabel.text = [NSString stringWithFormat:@"庇护%ld天",model.youpaiptotal_day]; self.youpaipvipV.hidden = YES; if (model.youpaipvip_icon.length != 0) { self.youpaipvipV.hidden = NO; [self.youpaipvipV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipvip_icon]]; } if (model.youpaipgender == 1) {//0未知 1女 2男 self.youpaipsexImgV.image = [UIImage imageNamed:@"vqu_images_D_dynamic_woman"]; }else{ self.youpaipsexImgV.image = [UIImage imageNamed:@"vqu_images_D_dynamic_man"]; } } - (void)setYoupaipindexPath:(NSIndexPath *)indexPath{ _youpaipindexPath = indexPath; self.youpaipnumL.text = [NSString stringWithFormat:@"%@",@(indexPath.row + 1)]; } - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end