// // YOUPAILCBoardCell.m // LiveChat // // Created by 张灿 on 2018/9/26. // Copyright © 2018年 caicai. All rights reserved. // #import "YOUPAILCBoardCell.h" @interface YOUPAILCBoardCell() @property(nonatomic,strong)UILabel* youpaipnumLabel; @property(nonatomic,strong)UILabel* youpaipnameLabel; //@property(nonatomic,strong)UILabel* valueDescLabel; @property(nonatomic,strong)UILabel* youpaipvalueLabel; @property(nonatomic,strong)UIImageView* youpaipavatarImgV; @property (nonatomic,strong)UIImageView *youpaipvipV; @end @implementation YOUPAILCBoardCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { self.selectionStyle = UITableViewCellSelectionStyleNone; //v.1.5.6适配暗黑模式 动态 [self.contentView setBackgroundColor:[UIColor whiteColor]]; [self youpaifinitUI]; } return self; } - (void)youpaifinitUI{ //68 48 self.youpaipnumLabel = [[UILabel alloc]init]; self.youpaipnumLabel.font = LCFont(18); self.youpaipnumLabel.textColor = LCTextGray; self.youpaipnumLabel.textAlignment = NSTextAlignmentLeft; [self.contentView addSubview:self.youpaipnumLabel]; [self.youpaipnumLabel makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.left).offset(15); make.top.equalTo(26); make.height.equalTo(@22); }]; self.youpaipavatarImgV = [[UIImageView alloc]init]; self.youpaipavatarImgV.contentMode = UIViewContentModeScaleAspectFill; self.youpaipavatarImgV.layer.cornerRadius = 29; self.youpaipavatarImgV.layer.masksToBounds = YES; [self.contentView addSubview:self.youpaipavatarImgV]; [self.youpaipavatarImgV makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.left).offset(50); make.top.equalTo(8); make.size.mas_equalTo(CGSizeMake(58,58)); }]; self.youpaipnameLabel = [[UILabel alloc]init]; self.youpaipnameLabel.font = LCFont14; self.youpaipnameLabel.textColor = HexColorFromRGB(0x333333); self.youpaipnameLabel.textAlignment = NSTextAlignmentLeft; [self.contentView addSubview:self.youpaipnameLabel]; [self.youpaipnameLabel makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.youpaipavatarImgV.right).offset(12); make.top.equalTo(27); make.height.equalTo(@20); }]; UIImageView *vipV = [[UIImageView alloc] init]; [self addSubview:vipV]; self.youpaipvipV = vipV; [vipV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.youpaipnameLabel.mas_right).offset(5.0f); make.centerY.equalTo(self.youpaipnameLabel); make.size.mas_offset(CGSizeMake(30.0f, 19.0f)); }]; self.youpaipvalueLabel = [[UILabel alloc]init]; self.youpaipvalueLabel.font = LCFont16; self.youpaipvalueLabel.textColor = HexColorFromRGB(0xaaaaaa); self.youpaipvalueLabel.textAlignment = NSTextAlignmentRight; [self.contentView addSubview:self.youpaipvalueLabel]; [self.youpaipvalueLabel makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.contentView.right).offset(-16); make.top.equalTo(20.5); make.height.equalTo(@19.5); }]; UILabel *label = [[UILabel alloc]init]; label.font = LCFont(9); label.textColor = HexColorFromRGB(0xaaaaaa); label.textAlignment = NSTextAlignmentRight; label.text = @"距离上一名差"; [self.contentView addSubview:label]; [label makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.contentView.right).offset(-16); make.bottom.equalTo(-19.5); make.height.equalTo(@12.5); }]; // self.valueDescLabel = [[UILabel alloc]init]; // self.valueDescLabel.font = LCFont14; // self.valueDescLabel.textColor = LCTextBlack; // self.valueDescLabel.textAlignment = NSTextAlignmentRight; // [self.contentView addSubview:self.valueDescLabel]; // [self.valueDescLabel makeConstraints:^(MASConstraintMaker *make) { // make.right.equalTo(self.contentView.right).offset(-105); // make.top.equalTo(24); // make.height.equalTo(@20); // }]; } - (void)setYoupaipboardModel:(YOUPAILCBoardModel *)boardModel{ _youpaipboardModel = boardModel; self.youpaipnumLabel.text = [NSString stringWithFormat:@"%zd",boardModel.youpaipno]; [self.youpaipavatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:boardModel.youpaipavatar]]; self.youpaipnameLabel.text = boardModel.youpaipnickname; self.youpaipvalueLabel.text = boardModel.youpaipgapMoney; self.youpaipvipV.hidden = YES; if (boardModel.youpaipvip_icon.length != 0) { self.youpaipvipV.hidden = NO; [self.youpaipvipV sd_setImageWithURL:[LCTools getImageUrlWithAddress:boardModel.youpaipvip_icon]]; } // self.valueLabel.text = [LCTools integralChange:boardModel.totalMoney]; // self.valueLabel.text = [NSString stringWithFormat:@"%zd",boardModel.totalMoney]; // if (self.type==2) { // self.valueDescLabel.text = @"礼物值"; // }else if (self.type==1){ // self.valueDescLabel.text = @"财富值"; // }else{ // self.valueDescLabel.text = @"大咖值"; // } } @end