12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- //
- // KBSignInView.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/9/27.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "KBSignInView.h"
- #import "KBSignInModel.h"
- @interface KBSignInView ()
- @property (nonatomic, strong) NSMutableArray *imgArray;
- @property (nonatomic, strong) NSMutableArray *lineArray;
- @end
- @implementation KBSignInView
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- CGFloat imgViewX= (FITSIZE(323)-20*7-16*2)/6;
- self.imgArray = [NSMutableArray arrayWithCapacity:0];
- self.lineArray = [NSMutableArray arrayWithCapacity:0];
- for (int i = 0; i < 7; i++) {
- UIImageView *imgView=[[UIImageView alloc]initWithFrame:CGRectMake(16+imgViewX*i+i*20, 0, 20, 20)];
- imgView.backgroundColor=[UIColor clearColor];
- // imgView.image = [UIImage imageNamed:@"noSignIn"];
- [self addSubview:imgView];
- [self.imgArray addObject:imgView];
- if (i>0) {
- UIView *line = [[UIView alloc] initWithFrame:CGRectMake(16+i*20+imgViewX*(i-1), 9, imgViewX, 2)];
- [self addSubview:line];
- // line.backgroundColor = [UIColor colorWithHexString:@"#EF4D2D"];
- [self.lineArray addObject:line];
- }
- }
-
- }
- return self;
- }
- - (void)setSignModelArr:(NSArray *)array {
- for (int i=0; i<self.imgArray.count; i++) {
- UIImageView *imgView = self.imgArray[i];
- if (i < array.count) {
- KBSignDaysModel *model = [KBSignDaysModel yy_modelWithJSON:array[i]];
- switch (model.type) {
- case 0:
- imgView.image = [UIImage imageNamed:@"noSignIn"];
- if (i>0) {
- UIView *line = self.lineArray[i-1];
- line.backgroundColor = [UIColor colorWithHexString:@"#F9B37F"];
- }
- break;
- case 1:
- imgView.image = [UIImage imageNamed:@"haveSignIn"];
- if (i>0) {
- UIView *line = self.lineArray[i-1];
- line.backgroundColor = [UIColor colorWithHexString:@"#EF4D2D"];
- }
- break;
- default:
- break;
- }
-
- }
-
- }
- }
- - (NSMutableArray *)imgArray {
- if (!_imgArray) {
- _imgArray = [NSMutableArray array];
- }
- return _imgArray;
- }
- @end
|