// // YOUPAILCSkillCollectionCell.m // LiveChat // // Created by 张灿 on 2018/9/9. // Copyright © 2018年 caicai. All rights reserved. // #import "YOUPAILCSkillCollectionCell.h" @interface YOUPAILCSkillCollectionCell() @end @implementation YOUPAILCSkillCollectionCell - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor clearColor]; [self youpaifsetupView]; } return self; } - (void)youpaifsetupView{ self.youpaipiconImgView = [[UIImageView alloc]init]; self.youpaipiconImgView.contentMode = UIViewContentModeScaleAspectFill; self.youpaipiconImgView.alpha = 0.3; [self addSubview:self.youpaipiconImgView]; [self.youpaipiconImgView makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.centerX); make.centerY.equalTo(self.centerY).offset(-12); make.size.mas_equalTo(CGSizeMake(42, 42)); }]; self.youpaipselectImgView = [[UIImageView alloc]init]; self.youpaipselectImgView.contentMode = UIViewContentModeScaleAspectFill; self.youpaipselectImgView.image = [UIImage imageNamed:@"vqu_images_skill_select"]; [self addSubview:self.youpaipselectImgView]; [self.youpaipselectImgView makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.youpaipiconImgView.right).offset(-5); make.bottom.equalTo(self.youpaipiconImgView.top).offset(10); make.size.mas_equalTo(CGSizeMake(18, 18)); }]; UILabel* statuLabel = [[UILabel alloc]init]; statuLabel.textColor = [UIColor whiteColor]; statuLabel.font = LCFont(11); statuLabel.textAlignment = NSTextAlignmentCenter; statuLabel.hidden = YES; statuLabel.layer.cornerRadius = 10; statuLabel.layer.masksToBounds = YES; [self addSubview:statuLabel]; self.youpaipstatuLabel = statuLabel; [statuLabel makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.youpaipiconImgView.top).offset(-10); make.left.equalTo(self.youpaipiconImgView.right).offset(-25); make.size.mas_equalTo(CGSizeMake(50, 20)); }]; UILabel* skillNameLabel = [[UILabel alloc]init]; skillNameLabel.alpha = 0.3; skillNameLabel.textColor = LCTextNormal; skillNameLabel.font = LCFont(13); skillNameLabel.textAlignment = NSTextAlignmentCenter; [self addSubview:skillNameLabel]; self.youpaipskillNameLabel = skillNameLabel; [skillNameLabel makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.youpaipiconImgView.bottom).offset(@5); make.height.equalTo(@20); make.width.equalTo(self.width); }]; } - (void)setYoupaipskillModel:(YOUPAILCSkillModel *)skillModel{ _youpaipskillModel = skillModel; self.youpaipselectImgView.hidden = YES; [self.youpaipiconImgView sd_setImageWithURL:[LCTools getImageUrlWithAddress:skillModel.youpaipicon]]; self.youpaipskillNameLabel.text = skillModel.youpaipname; if (skillModel.youpaipis_add == 1) { self.youpaipiconImgView.alpha = 1.0; self.youpaipskillNameLabel.alpha = 1.0; self.youpaipstatuLabel.hidden = NO; self.youpaipstatuLabel.text = @"已通过"; self.youpaipstatuLabel.backgroundColor = LCGreen; } } @end