153 lines
4.8 KiB
Objective-C
153 lines
4.8 KiB
Objective-C
//
|
|
// 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);
|
|
|
|
}];
|
|
|
|
[self bringSubviewToFront:jianyiLabel];
|
|
[self bringSubviewToFront:timeLabel];
|
|
|
|
}
|
|
|
|
- (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{
|
|
|
|
if ([minute isKindOfClass:[NSNull class]]) {
|
|
minute = @"17";
|
|
}
|
|
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
|