Skip to content

Commit

Permalink
fill contents
Browse files Browse the repository at this point in the history
  • Loading branch information
ykws committed Jun 1, 2017
1 parent 3f9d670 commit 06d4fc5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 12 additions & 0 deletions UAProgressView.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -94,4 +101,9 @@
*/
- (void)setProgress:(CGFloat)progress animated:(BOOL)animated;

/**
* Fill contents.
*/
- (void)addFill;

@end
10 changes: 9 additions & 1 deletion UAProgressView.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ - (void) setTintColor:(UIColor *)tintColor
[self tintColorDidChange];
}

- (UIColor*) fillColor
{
if (_fillColor == nil) {
return _tintColor;
}
return _fillColor;
}

#pragma mark - Layout

- (void)layoutSubviews {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 06d4fc5

Please sign in to comment.