// // MaskResultShareViewCell.m // GIGA // // Created by lianxiang on 2018/9/20. // Copyright © 2018年 com.giga.ios. All rights reserved. // #import "MaskResultShareViewCell.h" #import "MaskResultCandView.h" @implementation MaskResultShareViewCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { [self creatUI]; //self.backgroundColor = [UIColor blueColor]; self.selectionStyle = UITableViewCellSelectionStyleNone; } return self; } -(void)creatUI{ UILabel *shiheLabe = [[UILabel alloc] init]; shiheLabe.text = @"适合您的面膜是:"; shiheLabe.textColor = [UIColor blackColor]; shiheLabe.font = GIGA_TEXTFONTMEDIUM(18); [self addSubview:shiheLabe]; [shiheLabe sizeToFit]; [shiheLabe mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.mas_left).offset(25); make.top.mas_equalTo(self.mas_top).offset(40); }]; UILabel *candLabe = [[UILabel alloc] init]; candLabe.textColor = [UIColor blackColor]; candLabe.text = @"全效型"; candLabe.font = GIGA_TEXTFONTBOLD(30); self.candLabe = candLabe; [self addSubview:candLabe]; [candLabe sizeToFit]; [candLabe mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(shiheLabe.mas_right); make.top.mas_equalTo(self.mas_top).offset(30); }]; //小图标 NSArray * imagesArr = @[@"result_water",@"result_moon",@"result_push"]; MaskResultCandView *imagsBackView = [[MaskResultCandView alloc] initWith:imagesArr]; self.imagsBackView = imagsBackView; [self addSubview:imagsBackView]; [imagsBackView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(candLabe.mas_right).offset(5); make.size.mas_equalTo(CGSizeMake(68, 30)); make.centerY.mas_equalTo(shiheLabe.mas_centerY); }]; //shareBtn UIButton *shareBtn = [UIButton buttonWithType:UIButtonTypeCustom]; shareBtn.layer.masksToBounds = YES; shareBtn.layer.cornerRadius = 21; shareBtn.backgroundColor = GIGARGB(181, 14, 14, 1); [self addSubview:shareBtn]; self.shareBtn = shareBtn; [shareBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(150, 42)); make.top.mas_equalTo(imagsBackView.mas_bottom).offset(30); make.centerX.mas_equalTo(self.mas_centerX); }]; NSAttributedString *titl = [GiGaHelper stringWithText:@"分享页面" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTBOLD(20) leterSpace:0]; [shareBtn setAttributedTitle:titl forState:UIControlStateNormal]; UIImageView *logo = [[UIImageView alloc] init]; logo.image = [UIImage imageNamed:@"result_logo"]; [self addSubview:logo]; [logo mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.mas_left).offset(26); make.size.mas_equalTo(CGSizeMake(36, 36)); make.top.mas_equalTo(shareBtn.mas_bottom).offset(7); }]; UILabel *lastLabe = [[UILabel alloc] init]; lastLabe.text = @"让更多的朋友一起加入面膜时间吧!"; lastLabe.font = GIGA_TEXTFONTBOLD(12); lastLabe.textColor = GIGARGB(166, 33, 33, 1); [self addSubview:lastLabe]; [lastLabe sizeToFit]; [lastLabe mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(self.mas_centerX); make.top.mas_equalTo(shareBtn.mas_bottom).offset(15); }]; //3 UILabel *threeLabel = [[UILabel alloc] init]; threeLabel.text = @"3"; threeLabel.textColor = GIGARGB(240, 147, 147, 0.1); threeLabel.alpha = 0.6; threeLabel.font = GIGA_TEXTFONTMEDIUM(200); [self addSubview:threeLabel]; [threeLabel sizeToFit]; [threeLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(self.mas_right).offset(40); //纯数字上下有留白 make.size.mas_equalTo(CGSizeMake(threeLabel.frame.size.width, 145)); make.centerY.mas_equalTo(self.mas_centerY); }]; } -(void)kidTitle:(MaskTestResult *)model{ if (!model.mask || [model.mask isEqualToString:@""] || [model.mask isKindOfClass:[NSNull class]]) { model.mask = @"全效型"; } self.candLabe.text = model.mask; NSString *water = model.moisture ==1 ? @"result_water":@"result_wmz"; NSString *meibai = model.whitening ==1 ? @"result_moon":@"result_ylwmz"; NSString *tila= model.liftingTightening ==1 ? @"result_push":@"result_wmzzz"; [self.imagsBackView updateImages:@[water,meibai,tila]]; } -(void)layoutSubviews{ [super layoutSubviews]; } - (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