// // YOUPAILCSkillView.m // LiveChat // // Created by 张灿 on 2018/9/13. // Copyright © 2018年 caicai. All rights reserved. // #import "YOUPAILCSkillView.h" @interface YOUPAILCSkillView() @property(nonatomic,strong)YOUPAILCSkillModel* youpaipskillModel; @property(nonatomic,strong)UIImageView* youpaipiconImgV; @end @implementation YOUPAILCSkillView - (instancetype)initWithFrame:(CGRect)frame skillModel:(YOUPAILCSkillModel*)model{ if (self = [super initWithFrame:frame]) { self.youpaipskillModel = model; [self youpaifsetupView]; } return self; } - (void)youpaifsetupView{ self.layer.cornerRadius = 5; self.layer.masksToBounds = YES; self.backgroundColor = HexColorFromRGB(0x2A2935); UIImageView *iconImgView = [[UIImageView alloc] init]; [self addSubview:iconImgView]; [iconImgView makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.left).offset(12); // make.top.equalTo(self.top).offset(@18); make.centerY.equalTo(self.centerY); make.height.equalTo(@48); make.width.equalTo(@48); }]; [iconImgView sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipskillModel.youpaipicon]]; UILabel* label = [[UILabel alloc]init]; label.textColor = [UIColor whiteColor]; label.font = LCFont(14); label.text = [NSString stringWithFormat:@"技能:%@",self.youpaipskillModel.youpaipname]; [self addSubview:label]; [label makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(iconImgView.right).offset(10.0f); make.top.equalTo(iconImgView.top).offset(4.0f); make.height.equalTo(@17); }]; UILabel* valueLab = [[UILabel alloc]init]; valueLab.textColor = [UIColor whiteColor]; valueLab.font = LCFont(14); valueLab.text = [NSString stringWithFormat:@" %@钻石/分钟",self.youpaipskillModel.youpaipprice]; [self addSubview:valueLab]; [valueLab makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(iconImgView.right).offset(10.0f); make.bottom.equalTo(iconImgView.bottom).offset(-4.0f); make.height.equalTo(@17); }]; // UILabel* praiseLab = [[UILabel alloc]init]; // praiseLab.textColor = HexColorFromRGB(0x999999); // praiseLab.font = LCFont(12); // praiseLab.text = [NSString stringWithFormat:@"评分: %@分",self.skillModel.score]; // [self addSubview:praiseLab]; // [praiseLab makeConstraints:^(MASConstraintMaker *make) { // make.left.equalTo(iconImgView.right).offset(@8); // make.top.equalTo(label.bottom).offset(@4); // make.height.equalTo(@15); // }]; NobleSaleBtn* nobleSaleBtn = [[NobleSaleBtn alloc]init]; self.youpaipnobleSaleBtn = nobleSaleBtn; [self addSubview:nobleSaleBtn]; [nobleSaleBtn makeConstraints:^(MASConstraintMaker *make) { make.right.offset(-18); make.top.offset(22); make.size.mas_offset(CGSizeMake(65.0f, 13.0f)); }]; UIButton* priceBtn = [[UIButton alloc]init]; priceBtn.titleLabel.font = LCFont12; [priceBtn setTitle:@"修改价格" forState:(UIControlStateNormal)]; [priceBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; priceBtn.backgroundColor = HexColorFromRGB(0x4F4B5B); priceBtn.layer.cornerRadius = 13.5f; priceBtn.clipsToBounds = YES; // priceBtn.hidden = YES; self.youpaippriceBtn = priceBtn; [self addSubview:priceBtn]; [priceBtn makeConstraints:^(MASConstraintMaker *make) { make.right.offset(-12); make.top.equalTo(nobleSaleBtn.bottom).offset(5.0f); make.size.mas_offset(CGSizeMake(74.0f, 26.0f)); }]; } @end @implementation NobleSaleBtn - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { [self youpaifsetupView]; } return self; } - (void)youpaifsetupView{ self.youpaipbtnL = [[UILabel alloc]init]; self.youpaipbtnL.textColor = HexColorFromRGB(0xFFCF54); self.youpaipbtnL.font = LCFont(11.0f); self.youpaipbtnL.textAlignment = NSTextAlignmentRight; self.youpaipbtnL.text = @"贵族优惠"; [self addSubview:self.youpaipbtnL]; [self.youpaipbtnL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(0.0f); make.bottom.offset(0.0f); make.top.offset(0.0f); make.right.offset(-14.0f); }]; self.youpaipiconimgV = [[UIImageView alloc]init]; self.youpaipiconimgV.image = [UIImage imageNamed:@"vqu_images_game_arrow"]; self.youpaipiconimgV.contentMode = UIViewContentModeScaleAspectFill; [self addSubview:self.youpaipiconimgV]; [self.youpaipiconimgV mas_makeConstraints:^(MASConstraintMaker *make) { make.right.bottom.offset(0.0f); make.size.mas_offset(CGSizeMake(13, 13)); }]; } @end