//
//  KKProgressView.m
//  Open
//
//  Created by 雷俊博 on 2020/6/3.
//  Copyright © 2020 黄江涛 . All rights reserved.
//

#import "KKProgressView.h"

@interface KKProgressView ()

@property(strong,nonatomic)UIView *UIProess;

@end

@implementation KKProgressView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.layer.cornerRadius = CGRectGetHeight(self.bounds)/2;
        self.layer.masksToBounds = YES;
        self.backgroundColor = [UIColor colorWithHex:0xeeeeee];
        
        self.UIProess=[[UIView alloc]initWithFrame:CGRectMake(0, 0,0, CGRectGetHeight(self.bounds))];
        
        self.UIProess.backgroundColor = [UIColor colorWithHex:0x1887d3];
        
        
        [self addSubview:self.UIProess];
    }
    return self;
}

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    self.backgroundColor = [UIColor colorWithHex:0xeeeeee];
           
    self.UIProess=[[UIView alloc]initWithFrame:CGRectMake(0, 0,0, CGRectGetHeight(self.bounds))];
           
    self.UIProess.backgroundColor = [UIColor colorWithHex:0x1887d3];
    self.layer.cornerRadius = CGRectGetHeight(self.bounds)/2;
    self.layer.masksToBounds = YES;
           
    [self addSubview:self.UIProess];
    
}

#pragma mark - getters and setters
-(void)setProgress:(CGFloat)progress
{
    CGRect frame = self.UIProess.frame;
    
    frame.size.width = progress * CGRectGetWidth(self.bounds);
    
    self.UIProess.frame = frame;
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
