add
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#import "GiGaUser.h"
|
||||
#import "GiGaUserManager.h"
|
||||
#import "GiGaBaseAPiRequest.h"
|
||||
#import "MaskTestResultVC.h"
|
||||
|
||||
|
||||
@interface GiGaMaskTaskViewController ()<MaskCirCularProGressViewDelegate>
|
||||
@@ -394,7 +395,6 @@
|
||||
make.height.and.width.mas_equalTo(136);
|
||||
make.centerX.mas_equalTo(self.view.mas_centerX);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark 面膜时间背景音乐
|
||||
@@ -488,7 +488,20 @@
|
||||
|
||||
#pragma mark 开始测试
|
||||
-(void)testBtnAcion:(UIButton *)btn{
|
||||
NSDictionary *dic = @{
|
||||
@"dryness":@"0.41",
|
||||
@"drynessPercent":@"41%",
|
||||
@"mask":@"",
|
||||
@"minute":@"19",
|
||||
@"oiliness":@"0.59",
|
||||
@"oilinessPercent":@"59%"
|
||||
};
|
||||
MaskTestResult *model =[[MaskTestResult alloc] initWithDictionary:dic error:nil];
|
||||
MaskTestResultVC *resultVC = [[MaskTestResultVC alloc] init];
|
||||
resultVC.model = model;
|
||||
[self.navigationController pushViewController:resultVC animated:YES];
|
||||
|
||||
return;
|
||||
GiGaQuestionVC *questionVC = [[GiGaQuestionVC alloc] init];
|
||||
[self.navigationController pushViewController:questionVC animated:YES];
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
//
|
||||
|
||||
#import "GiGaBaseViewController.h"
|
||||
#import "MaskTestResult.h"
|
||||
|
||||
@interface MaskTestResultVC : GiGaBaseViewController
|
||||
@property (nonatomic,strong) MaskTestResult *model;
|
||||
|
||||
@end
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
//
|
||||
|
||||
#import "MaskTestResultVC.h"
|
||||
#import "MaskResultMinViewCell.h"
|
||||
#import "MaskResultPercentCell.h"
|
||||
#import "MaskResultShareViewCell.h"
|
||||
|
||||
@interface MaskTestResultVC ()
|
||||
|
||||
@@ -18,21 +21,86 @@
|
||||
[super viewDidLoad];
|
||||
[self addNavTitile:@"测试结果"];
|
||||
// Do any additional setup after loading the view.
|
||||
|
||||
[self.view addSubview:self.tableView];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.backgroundColor = [UIColor whiteColor];
|
||||
self.tableView.separatorStyle = UITableViewCellSelectionStyleNone;
|
||||
self.tableView.sectionFooterHeight = 0;
|
||||
self.tableView.estimatedSectionFooterHeight= 0;
|
||||
self.tableView.estimatedSectionHeaderHeight = 0;
|
||||
self.tableView.frame = CGRectMake(0,0, KMainW, self.view.bounds.size.height - SAFE_NAV_HEIGHT);
|
||||
[self.tableView registerClass:[MaskResultPercentCell class] forCellReuseIdentifier:@"MaskResultPercentCell"];
|
||||
[self.tableView registerClass:[MaskResultMinViewCell class] forCellReuseIdentifier:@"MaskResultMinViewCell"];
|
||||
[self.tableView registerClass:[MaskResultShareViewCell class] forCellReuseIdentifier:@"MaskResultShareViewCell"];
|
||||
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return 3;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
|
||||
if (indexPath.row == 0) {
|
||||
static NSString *cellID = @"MaskResultPercentCell";
|
||||
MaskResultPercentCell *cell =[tableView dequeueReusableCellWithIdentifier:cellID];
|
||||
if (!cell) {
|
||||
cell = [[MaskResultPercentCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID];;
|
||||
}
|
||||
|
||||
[cell loadCellData:self.model];
|
||||
return cell;
|
||||
|
||||
}else if (indexPath.row == 1){
|
||||
static NSString *cellID = @"MaskResultMinViewCell";
|
||||
MaskResultMinViewCell *cell =[tableView dequeueReusableCellWithIdentifier:cellID];
|
||||
if (!cell) {
|
||||
cell = [[MaskResultMinViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID];;
|
||||
}
|
||||
[cell loadMineWith:self.model.minute];
|
||||
return cell;
|
||||
}else if (indexPath.row == 2){
|
||||
static NSString *cellID = @"MaskResultShareViewCell";
|
||||
MaskResultShareViewCell *cell =[tableView dequeueReusableCellWithIdentifier:cellID];
|
||||
if (!cell) {
|
||||
cell = [[MaskResultShareViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID];;
|
||||
}
|
||||
|
||||
[cell kidTitle:self.model.mask];
|
||||
|
||||
return cell;
|
||||
}
|
||||
return nil;
|
||||
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
CGFloat viewH = KMainH - SAFE_NAV_HEIGHT;
|
||||
CGFloat cellH = viewH / 3 ;
|
||||
return cellH;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
|
||||
return 0.1;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
||||
|
||||
{ return 0.1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// MaskResultCandView.h
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/20.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface MaskResultCandView : UIView
|
||||
@property(nonatomic,strong) NSArray *imagesArr;
|
||||
- (instancetype)initWith:(NSArray *)images;
|
||||
@end
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// MaskResultCandView.m
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/20.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MaskResultCandView.h"
|
||||
|
||||
@implementation MaskResultCandView
|
||||
|
||||
- (instancetype)initWith:(NSArray *)images{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
|
||||
self.imagesArr = images;
|
||||
[self creatSubs];
|
||||
}
|
||||
return self;
|
||||
|
||||
}
|
||||
|
||||
-(void)creatSubs{
|
||||
|
||||
for (NSInteger i=0; i<self.imagesArr.count; i ++) {
|
||||
UIImageView *image = [[UIImageView alloc] init];
|
||||
image.contentMode = UIViewContentModeScaleAspectFill;
|
||||
image.image = [UIImage imageNamed:self.imagesArr[i]];
|
||||
image.layer.shadowColor = [UIColor blackColor].CGColor;
|
||||
image.layer.shadowOpacity = 0.2;
|
||||
image.layer.shadowOffset = CGSizeMake(0, 1);
|
||||
[self addSubview:image];
|
||||
[image mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(20, 29));
|
||||
make.left.mas_equalTo(self.mas_left).offset(i*(8 + 20));
|
||||
make.centerY.mas_equalTo(self.mas_centerY);
|
||||
}];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
-(void)layoutIfNeeded{
|
||||
[super layoutIfNeeded];
|
||||
|
||||
}
|
||||
|
||||
-(void)layoutSubviews{
|
||||
[super layoutSubviews];
|
||||
|
||||
//[self creatSubs];
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// MaskResultMinViewCell.h
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/20.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface MaskResultMinViewCell : UITableViewCell
|
||||
-(void)loadMineWith:(NSString *)minute;
|
||||
@property (nonatomic,strong) UILabel *timeLabel;
|
||||
@end
|
||||
@@ -0,0 +1,146 @@
|
||||
//
|
||||
// MaskResultMinViewCell.m
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/20.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MaskResultMinViewCell.h"
|
||||
@interface MaskResultMinViewCell()
|
||||
@property(nonatomic,strong) UILabel *twoLabel;
|
||||
@property(nonatomic,strong) UIView *colorView;
|
||||
@end
|
||||
@implementation MaskResultMinViewCell
|
||||
- (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 *twoLabel = [[UILabel alloc] init];
|
||||
twoLabel.text = @"2";
|
||||
twoLabel.textColor = GIGARGB(240, 147, 147, 0.1);
|
||||
twoLabel.alpha = 0.6;
|
||||
twoLabel.font = GIGA_TEXTFONTMEDIUM(200);
|
||||
//oneLabel.backgroundColor = [UIColor redColor];
|
||||
[self addSubview:twoLabel];
|
||||
self.twoLabel = twoLabel;
|
||||
[twoLabel sizeToFit];
|
||||
|
||||
[twoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.mas_left).offset(-40);
|
||||
//纯数字上下有留白
|
||||
make.size.mas_equalTo(CGSizeMake(twoLabel.frame.size.width, 145));
|
||||
make.bottom.mas_equalTo(self.mas_bottom);
|
||||
}];
|
||||
|
||||
UILabel *jianyiLabel = [[UILabel alloc] init];
|
||||
//jianyiLabel.backgroundColor = [UIColor redColor];
|
||||
jianyiLabel.text = @"建议敷面膜时间";
|
||||
jianyiLabel.textColor = [UIColor blackColor];
|
||||
jianyiLabel.font = GIGA_TEXTFONTBOLD(24);
|
||||
[self addSubview:jianyiLabel];
|
||||
[jianyiLabel sizeToFit];
|
||||
|
||||
[jianyiLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.mas_left).offset(40);
|
||||
make.top.mas_equalTo(self.mas_top).offset(36);
|
||||
|
||||
}];
|
||||
//时间⌚️
|
||||
UILabel *timeLabel = [[UILabel alloc] init];
|
||||
timeLabel.textColor = [UIColor blackColor];
|
||||
timeLabel.font = GIGA_TEXTFONTBOLD(35);
|
||||
timeLabel.text = @"17分钟";
|
||||
self.timeLabel = timeLabel;
|
||||
[self addSubview:timeLabel];
|
||||
[timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.mas_left).offset(73);
|
||||
make.top.mas_equalTo(jianyiLabel.mas_bottom).offset(20);
|
||||
}];
|
||||
|
||||
//左侧红色梯形区域
|
||||
|
||||
UIView *colorView = [[UIView alloc] init];
|
||||
[self addSubview:colorView];
|
||||
self.colorView = colorView;
|
||||
[colorView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(KMainW - 82);
|
||||
make.height.mas_equalTo(self.mas_height);
|
||||
make.centerY.mas_equalTo(self.mas_centerY);
|
||||
make.right.mas_equalTo(self.mas_right);
|
||||
|
||||
}];
|
||||
//沙漏
|
||||
UIImageView *satckImageVIew = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"result_time"]];
|
||||
satckImageVIew.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[self addSubview:satckImageVIew];
|
||||
[satckImageVIew mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(121);
|
||||
make.height.mas_equalTo(self.mas_height);
|
||||
make.centerY.mas_equalTo(self.mas_centerY);
|
||||
make.right.mas_equalTo(self.mas_right).offset(-30);
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)layoutSubviews{
|
||||
[super layoutSubviews];
|
||||
[self drawViewInView:self.colorView backColor:GIGA_MAIN_BGCOLOR];
|
||||
}
|
||||
|
||||
-(void)drawViewInView:(UIView *)view backColor:(UIColor *)color{
|
||||
|
||||
CGSize finalSize = CGSizeMake(CGRectGetWidth(view.bounds), CGRectGetHeight(view.bounds));
|
||||
|
||||
CAShapeLayer *layer = [CAShapeLayer layer];
|
||||
UIBezierPath *bezier = [UIBezierPath bezierPath];
|
||||
[bezier moveToPoint:CGPointMake(0,finalSize.height)];
|
||||
[bezier addLineToPoint:CGPointMake(finalSize.width, finalSize.height)];
|
||||
[bezier addLineToPoint:CGPointMake(finalSize.width,0)];
|
||||
[bezier addLineToPoint:CGPointMake(finalSize.width*0.424, 0)];
|
||||
[bezier addLineToPoint:CGPointMake(0,finalSize.height)];
|
||||
layer.path = bezier.CGPath;
|
||||
layer.fillColor = color.CGColor;
|
||||
|
||||
layer.shadowPath = bezier.CGPath;
|
||||
layer.shadowColor = [UIColor blackColor].CGColor;
|
||||
layer.shadowOffset = CGSizeMake(1, 1);
|
||||
layer.shadowOpacity = 0.6;
|
||||
[view.layer addSublayer:layer];
|
||||
|
||||
}
|
||||
|
||||
-(void)loadMineWith:(NSString *)minute{
|
||||
NSString *time = [NSString stringWithFormat:@"%@分钟",minute];
|
||||
self.timeLabel.text = time;
|
||||
|
||||
}
|
||||
|
||||
-(void)laoutSettings{
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (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
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// MaskResultPercentCell.h
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/20.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "MaskTestResult.h"
|
||||
|
||||
@interface MaskResultPercentCell : UITableViewCell
|
||||
-(void)loadCellData:(MaskTestResult *)model;
|
||||
@property (nonatomic,strong) UIView *oilView;
|
||||
@property (nonatomic,strong) UILabel *oilLabe;
|
||||
@property (nonatomic,strong) UILabel *waterlabe;
|
||||
@property (nonatomic,strong) UIView *percentColorView;
|
||||
@property (nonatomic) CADisplayLink *displayLink;
|
||||
|
||||
@property (nonatomic) int oilMAXProgress;
|
||||
@property (nonatomic) int waterMAXPorgress;
|
||||
@property (nonatomic) CGFloat oilness;
|
||||
//@property (nonatomic) CGFloat waterness;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,219 @@
|
||||
//
|
||||
// MaskResultPercentCell.m
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/20.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MaskResultPercentCell.h"
|
||||
|
||||
@implementation MaskResultPercentCell
|
||||
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
|
||||
{
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
if (self) {
|
||||
|
||||
|
||||
[self creatUI];
|
||||
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)creatUI{
|
||||
|
||||
self.backgroundColor = [UIColor whiteColor];
|
||||
|
||||
UIView *percentColorView = [[UIView alloc] init];
|
||||
percentColorView.backgroundColor = GIGARGB(139, 231, 250, 1);
|
||||
[self addSubview:percentColorView];
|
||||
self.percentColorView = percentColorView;
|
||||
|
||||
[percentColorView mas_makeConstraints:^(MASConstraintMaker *make){
|
||||
make.size.mas_equalTo(CGSizeMake(98, 127));
|
||||
make.top.mas_equalTo(self.mas_top).offset(44);
|
||||
make.left.mas_equalTo(self.mas_left).offset(60);
|
||||
}];
|
||||
|
||||
[self layoutIfNeeded];
|
||||
//默认0.5
|
||||
CGFloat oilLaerH = percentColorView.frame.size.height * 0.5;
|
||||
UIView *oilView= [[UIView alloc] init];
|
||||
oilView.backgroundColor = GIGARGB(255, 191, 128, 1);
|
||||
oilView.frame = CGRectMake(0,0,percentColorView.frame.size.width, 0);
|
||||
self.oilView = oilView;
|
||||
[percentColorView addSubview:oilView];
|
||||
|
||||
|
||||
UIImageView *topLineimage = [[UIImageView alloc] init];
|
||||
topLineimage.image = [UIImage imageNamed:@"result_line"];
|
||||
[self addSubview:topLineimage];
|
||||
[topLineimage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.mas_left).offset(44);
|
||||
make.size.mas_equalTo(CGSizeMake(120, 5.2));
|
||||
make.top.mas_equalTo(21);
|
||||
}];
|
||||
UIImageView *shalouImage = [[UIImageView alloc] init];
|
||||
shalouImage.image = [UIImage imageNamed:@"result_percent"];
|
||||
[self addSubview:shalouImage];
|
||||
[shalouImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(topLineimage.mas_bottom).offset(7);
|
||||
make.left.mas_equalTo(self.mas_left).offset(60);
|
||||
make.size.mas_equalTo(CGSizeMake(98, 149));
|
||||
}];
|
||||
|
||||
UIImageView *bootpmLine = [[UIImageView alloc] init];
|
||||
bootpmLine.image = [UIImage imageNamed:@"result_line"];
|
||||
[self addSubview:bootpmLine];
|
||||
[bootpmLine mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.mas_left).offset(44);
|
||||
make.size.mas_equalTo(CGSizeMake(120, 5.2));
|
||||
make.top.mas_equalTo(shalouImage.mas_bottom).offset(7);
|
||||
|
||||
}];
|
||||
|
||||
//皮肤水油比
|
||||
UILabel *duibiLabel = [[UILabel alloc] init];
|
||||
duibiLabel.text = @"皮肤水油比";
|
||||
duibiLabel.textColor = GIGARGB(55, 55, 55, 1);
|
||||
duibiLabel.font = GIGA_TEXTFONTBOLD(24);
|
||||
[self addSubview:duibiLabel];
|
||||
[duibiLabel sizeToFit];
|
||||
[duibiLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(topLineimage.mas_right).offset(13);
|
||||
make.top.mas_equalTo(self.mas_top).offset(12);
|
||||
}];
|
||||
|
||||
UIImageView *oilPercentgaurd =[[UIImageView alloc] init];
|
||||
oilPercentgaurd.image = [UIImage imageNamed:@"result_oillider"];
|
||||
[self addSubview:oilPercentgaurd];
|
||||
[oilPercentgaurd mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(shalouImage.mas_right).offset(-2);
|
||||
make.size.mas_equalTo(CGSizeMake(27,17));
|
||||
make.top.mas_equalTo(duibiLabel.mas_bottom).mas_equalTo(30);
|
||||
}];
|
||||
|
||||
//oil percent
|
||||
UILabel *oilLabe = [[UILabel alloc]init];
|
||||
oilLabe.text = @"50%";
|
||||
oilLabe.textColor = GIGARGB(255, 191, 128, 1);
|
||||
oilLabe.font = GIGA_TEXTFONTMEDIUM(36);
|
||||
[self addSubview:oilLabe];
|
||||
[oilLabe sizeToFit];
|
||||
self.oilLabe = oilLabe;
|
||||
[oilLabe mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(oilPercentgaurd.mas_right).offset(0);
|
||||
make.bottom.mas_equalTo(oilPercentgaurd.mas_top).offset(19);
|
||||
}];
|
||||
|
||||
UIImageView *watergaurd = [[UIImageView alloc] init];
|
||||
watergaurd.image = [UIImage imageNamed:@"result_waterlider"];
|
||||
[self addSubview:watergaurd];
|
||||
[watergaurd mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(shalouImage.mas_right).offset(2);
|
||||
make.size.mas_equalTo(CGSizeMake(42,19));
|
||||
make.bottom.mas_equalTo(shalouImage.mas_bottom).mas_equalTo(-24);
|
||||
}];
|
||||
|
||||
UILabel *waterlabe = [[UILabel alloc] init];
|
||||
waterlabe.text = @"50%";
|
||||
waterlabe.textColor = GIGARGB(139, 231, 250, 1);
|
||||
waterlabe.font = GIGA_TEXTFONTMEDIUM(36);
|
||||
[waterlabe sizeToFit];
|
||||
[self addSubview:waterlabe];
|
||||
self.waterlabe = waterlabe;
|
||||
[waterlabe mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(watergaurd.mas_right).offset(-19);
|
||||
make.bottom.mas_equalTo(watergaurd.mas_top).offset(12);
|
||||
}];
|
||||
|
||||
UILabel *oneLabel = [[UILabel alloc] init];
|
||||
oneLabel.text = @"1";
|
||||
oneLabel.textColor = GIGARGB(240, 147, 147, 0.1);
|
||||
oneLabel.alpha = 0.6;
|
||||
oneLabel.font = GIGA_TEXTFONTMEDIUM(200);
|
||||
[self addSubview:oneLabel];
|
||||
[oneLabel sizeToFit];
|
||||
[oneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.mas_centerY);
|
||||
make.right.mas_equalTo(self.mas_right).offset(-26);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
-(void)labProgresAction{
|
||||
|
||||
CALayer *presentLayer = self.oilView.layer.presentationLayer;
|
||||
[self.oilView setNeedsDisplay];
|
||||
|
||||
CGFloat percent = CGRectGetHeight(presentLayer.frame) / self.percentColorView.frame.size.height*self.oilness;
|
||||
//NSLog(@"%.2f",CGRectGetHeight(presentLayer.frame));
|
||||
|
||||
CGFloat curentOilprogress = percent * self.oilMAXProgress;
|
||||
|
||||
int oilInt = (int) curentOilprogress;
|
||||
//NSLog(@"%d",oilInt);
|
||||
self.oilLabe.text = [NSString stringWithFormat:@"%d%@",oilInt,@"%"];
|
||||
|
||||
|
||||
CGFloat waterpercent = CGRectGetHeight(presentLayer.frame) / self.percentColorView.frame.size.height*(1-self.oilness);
|
||||
CGFloat curentWaterprogress = waterpercent * self.waterMAXPorgress;
|
||||
int waterInt = (int)curentWaterprogress;
|
||||
self.waterlabe.text = [NSString stringWithFormat:@"%d%@",waterInt,@"%"];
|
||||
|
||||
}
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
|
||||
}
|
||||
|
||||
- (void)layoutSubviews{
|
||||
|
||||
}
|
||||
|
||||
-(void)loadCellData:(MaskTestResult *)model
|
||||
{
|
||||
self.oilness = [model.oiliness floatValue] ;
|
||||
self.oilMAXProgress = [model.oiliness floatValue] *100 ;
|
||||
self.waterMAXPorgress = 100 - self.oilMAXProgress;
|
||||
self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(labProgresAction)];
|
||||
[self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
|
||||
|
||||
NSTimeInterval durition = 1.0;
|
||||
|
||||
if (!model.oiliness || [model.oiliness isEqualToString:@""] || [model.oiliness isKindOfClass:[NSNull class]]) {
|
||||
model.oiliness = @"0.5";
|
||||
}
|
||||
|
||||
CGFloat oil = [model.oiliness floatValue];
|
||||
[UIView setAnimationDelegate:self];
|
||||
[UIView animateWithDuration:durition animations:^{
|
||||
|
||||
self.oilView.frame = CGRectMake(0, 0, self.percentColorView.frame.size.width, self.percentColorView.frame.size.height * oil);
|
||||
} completion:^(BOOL finished) {
|
||||
[self.displayLink invalidate];
|
||||
self.displayLink = nil;
|
||||
self.oilLabe.text = model.oilinessPercent;
|
||||
self.waterlabe.text = model.drynessPercent;
|
||||
|
||||
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// MaskResultShareViewCell.h
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/20.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface MaskResultShareViewCell : UITableViewCell
|
||||
@property (nonatomic,strong) UIButton *shareBtn;
|
||||
-(void)kidTitle:(NSString *)title;
|
||||
@property (nonatomic,strong) UILabel *candLabe;
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,140 @@
|
||||
//
|
||||
// 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 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:(NSString *)title{
|
||||
if (!title || [title isEqualToString:@""] || [title isKindOfClass:[NSNull class]]) {
|
||||
title = @"全效型";
|
||||
}
|
||||
self.candLabe.text = title;
|
||||
|
||||
}
|
||||
-(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
|
||||
Reference in New Issue
Block a user