From 06d4fc51ce98a46e57c1a69e397936a4ef655194 Mon Sep 17 00:00:00 2001 From: Yoshiyuki Kawashima Date: Thu, 1 Jun 2017 22:01:53 +0900 Subject: [PATCH] fill contents refs #21 --- UAProgressView.h | 12 ++++++++++++ UAProgressView.m | 10 +++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/UAProgressView.h b/UAProgressView.h index b0cea1d..34c4ecf 100644 --- a/UAProgressView.h +++ b/UAProgressView.h @@ -73,6 +73,13 @@ */ @property (nonatomic, strong) UIColor *tintColor; +/** + * The color of the fill contents + * + * Defaults to same tintColor + */ +@property (nonatomic, strong) UIColor *fillColor; + /** * Gets/sets the progress, from 0.0 to 1.0. Progress < 0 is set to 0.0, progress > 1 is set to 1.0 */ @@ -94,4 +101,9 @@ */ - (void)setProgress:(CGFloat)progress animated:(BOOL)animated; +/** + * Fill contents. + */ +- (void)addFill; + @end diff --git a/UAProgressView.m b/UAProgressView.m index ced82ae..ab1aa93 100644 --- a/UAProgressView.m +++ b/UAProgressView.m @@ -130,6 +130,14 @@ - (void) setTintColor:(UIColor *)tintColor [self tintColorDidChange]; } +- (UIColor*) fillColor +{ + if (_fillColor == nil) { + return _tintColor; + } + return _fillColor; +} + #pragma mark - Layout - (void)layoutSubviews { @@ -225,7 +233,7 @@ - (void)onValueLabelUpdateTimer:(NSTimer *)timer { - (void)addFill { if (self.fillOnTouch) { // update the layer model - self.progressView.layer.backgroundColor = [self tintColor].CGColor; + self.progressView.layer.backgroundColor = [self fillColor].CGColor; // call block if (self.fillChangedBlock) {