// // YOUPAILZVipRenewItemCell.m // VQU // // Created by CY on 2021/8/25. // Copyright © 2021 MS. All rights reserved. // #import "YOUPAILZVipRenewItemCell.h" @interface YOUPAILZVipRenewItemCell () @property (nonatomic,weak) UIImageView *youpaipiconImgV; @property (nonatomic,weak) UILabel *youpaipnameL; @property (nonatomic,weak) UILabel *youpaipmoneyL; @property (nonatomic,weak)UIImageView *youpaipselectedImgV; @end @implementation YOUPAILZVipRenewItemCell - (instancetype)initWithFrame:(CGRect)frame{ if (self = [super initWithFrame:frame]) { [self youpaifinitUI]; } return self; } - (void)youpaifinitUI{ self.backgroundColor = HexColorFromRGB(0x31303D); self.layer.cornerRadius = ScaleSize(5.0f); self.clipsToBounds = YES; self.layer.borderColor = HexColorFromRGB(0xFF2F64).CGColor; UIImageView *iconImgV = [[UIImageView alloc] init]; [self.contentView addSubview:iconImgV]; self.youpaipiconImgV = iconImgV; [iconImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.offset(ScaleSize(6.0f)); make.centerX.equalTo(self.contentView); make.size.mas_offset(CGSizeMake(ScaleSize(36.0f), ScaleSize(33.0f))); }]; UILabel *nameL = [[UILabel alloc] init]; nameL.font = LCFont(ScaleSize(13.0f)); nameL.textColor = [UIColor whiteColor]; nameL.textAlignment = NSTextAlignmentCenter; [self.contentView addSubview:nameL]; self.youpaipnameL = nameL; [nameL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(ScaleSize(12.0f)); make.top.equalTo(iconImgV.mas_bottom).offset(ScaleSize(5.0f)); make.right.offset(ScaleSize(-12.0f)); }]; UIImageView *selectedImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_ic_profile_vip_selected"]]; selectedImgV.hidden = YES; [self.contentView addSubview:selectedImgV]; self.youpaipselectedImgV = selectedImgV; [selectedImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.right.bottom.offset(0.0f); make.size.mas_offset(CGSizeMake(ScaleSize(27.0f), ScaleSize(27.0f))); }]; UILabel *moneyL = [[UILabel alloc] init]; moneyL.font = LCFont(ScaleSize(11.0f)); moneyL.textColor = HexColorFromRGB(0xFF4848); moneyL.textAlignment = NSTextAlignmentCenter; [self.contentView addSubview:moneyL]; self.youpaipmoneyL = moneyL; [moneyL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(ScaleSize(12.0f)); make.top.equalTo(nameL.mas_bottom).offset(ScaleSize(4.0f)); make.right.offset(ScaleSize(-12.0f)); }]; } -(void)youpaifreloadWithModel:(YOUPAILZVipRenewModel *)model{ self.youpaipselectedImgV.hidden = YES; self.layer.borderWidth = 0.0f; self.youpaipnameL.text = model.youpaipname; [self.youpaipiconImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipimg]]; if ([model.youpaippay_info.youpaipstatus isEqual:@"forbid"]) { self.youpaipmoneyL.textColor = HexColorFromRGB(0x58575E); self.youpaipmoneyL.text = model.youpaippay_info.youpaiptip; }else{ self.youpaipmoneyL.textColor = HexColorFromRGB(0xFF4848); self.youpaipmoneyL.text = [NSString stringWithFormat:@"%@元",model.youpaippay_info.youpaipprice]; if (model.youpaipisSelected) { self.youpaipselectedImgV.hidden = NO; self.layer.borderWidth = 1.0f; } } } @end