Initial commit
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
//
|
||||
// QianDaoTimeLineView.m
|
||||
// CollectionViewTest
|
||||
//
|
||||
// Created by imac on 17/3/6.
|
||||
// Copyright © 2017年 xiang. All rights reserved.
|
||||
//
|
||||
|
||||
#import "QianDaoTimeLineView.h"
|
||||
|
||||
@implementation QianDaoTimeLineView
|
||||
|
||||
-(id)initWithFrame:(CGRect)frame{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
|
||||
[self creatSub];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)awakeFromNib{
|
||||
[super awakeFromNib];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
[self creatSub];
|
||||
|
||||
}
|
||||
|
||||
-(void)creatSub{
|
||||
|
||||
for (int i = 0; i<=6; i++) {
|
||||
CGFloat marginTosuper = 15;
|
||||
CGFloat imgW = 22;
|
||||
CGFloat lineW = (self.frame.size.width - 15*2 - imgW * 7)/6;
|
||||
|
||||
UIImageView *signInImg = [[UIImageView alloc] init];
|
||||
signInImg.frame = CGRectMake(marginTosuper+i*(imgW + lineW),0, imgW, imgW);
|
||||
[self addSubview:signInImg];
|
||||
if (!_dayValue) {
|
||||
_dayValue = 0;
|
||||
}
|
||||
if (i<6) {
|
||||
UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(signInImg.frame), CGRectGetMidY(signInImg.frame) -2, lineW, 2)];
|
||||
lineView.backgroundColor = [UIColor colorWithRed:255.0/256.0 green:115.0/256.0 blue:92.0/256.0 alpha:1];
|
||||
[self addSubview:lineView];
|
||||
if (i>=_dayValue) {
|
||||
lineView.backgroundColor = [UIColor colorWithRed:221.0/256.0 green:221.0/256.0 blue:221.0/256.0 alpha:1];
|
||||
}
|
||||
}
|
||||
|
||||
UILabel *title=[[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMidX(signInImg.frame) - 36/2, CGRectGetMaxY(signInImg.frame) + 6,36,13)];
|
||||
title.text = [NSString stringWithFormat:@"第%d天",i + 1];
|
||||
title.textAlignment = NSTextAlignmentCenter;
|
||||
title.font = [UIFont systemFontOfSize:12];
|
||||
[self addSubview:title];
|
||||
|
||||
|
||||
if (i<_dayValue) {
|
||||
signInImg.image = [UIImage imageNamed:@"signin_condition_succeed"];
|
||||
title.textColor = [UIColor colorWithRed:153.0/256.0 green:153.0/256.0 blue:153.0/256.0 alpha:1];
|
||||
}else if (i==_dayValue){
|
||||
if (_isSignInToday) {
|
||||
signInImg.image = i==6 ? [UIImage imageNamed:@"signin_condition_gift_achieve"]: [UIImage imageNamed:@"signin_condition_succeed"];
|
||||
|
||||
}else{
|
||||
|
||||
signInImg.image = i==6 ? [UIImage imageNamed:@"signin_condition_gift_conduct"]: [UIImage imageNamed:@"signin_condition_conduct"];
|
||||
}
|
||||
|
||||
title.textColor = [UIColor colorWithRed:254.0/256.0 green:156.0/256.0 blue:139.0/256.0 alpha:1];
|
||||
|
||||
}else{
|
||||
|
||||
signInImg.image = i==6 ? [UIImage imageNamed:@"signin_condition_gift"]: [UIImage imageNamed:@"signin_condition_await"];
|
||||
title.textColor = [UIColor colorWithRed:221.0/256.0 green:221.0/256.0 blue:221.0/256.0 alpha:1];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user