Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Pod/Classes/MBCircularProgressBarLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ typedef NS_ENUM(NSInteger, MBCircularProgressBarAppearanceType) {
/**
* The color of the progress bar
*/
@property (nonatomic,strong) UIColor *progressColor;
@property (nonatomic,assign) CGColorRef progressColor;

/**
* The color of the progress bar frame
*/
@property (nonatomic,strong) UIColor *progressStrokeColor;
@property (nonatomic,assign) CGColorRef progressStrokeColor;

/**
* The shape of the progress bar cap {kCGLineCapButt=0, kCGLineCapRound=1, kCGLineCapSquare=2}
Expand Down
40 changes: 20 additions & 20 deletions Pod/Classes/MBCircularProgressBarLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ - (void)drawProgressBar:(CGRect)rect context:(CGContextRef)c{


CGContextAddPath(c, strokedArc);
CGContextSetFillColorWithColor(c, self.progressColor.CGColor);
CGContextSetStrokeColorWithColor(c, self.progressStrokeColor.CGColor);
CGContextSetFillColorWithColor(c, self.progressColor);
CGContextSetStrokeColorWithColor(c, self.progressStrokeColor);
CGContextDrawPath(c, kCGPathFillStroke);

CGPathRelease(arc);
Expand Down Expand Up @@ -193,28 +193,28 @@ - (void)drawText:(CGRect)rect context:(CGContextRef)c{

#pragma mark - Override methods to support animations

+ (BOOL)isCustomAnimationKey:(NSString *)key {
return [key isEqualToString:@"value"] || [key isEqualToString:@"progressColor"] || [key isEqualToString:@"progressStrokeColor"];
}

+ (BOOL)needsDisplayForKey:(NSString *)key {
if ([key isEqualToString:@"value"]) {
return YES;
}
if ([self isCustomAnimationKey:key]) return true;
return [super needsDisplayForKey:key];
}

- (id<CAAction>)actionForKey:(NSString *)event{
if ([self presentationLayer] != nil) {
if ([event isEqualToString:@"value"]) {
id animation = [super actionForKey:@"backgroundColor"];

if (animation == nil || [animation isEqual:[NSNull null]])
{
[self setNeedsDisplay];
return [NSNull null];
}
[animation setKeyPath:event];
[animation setFromValue:[self.presentationLayer valueForKey:@"value"]];
[animation setToValue:nil];
return animation;

- (id<CAAction>)actionForKey:(NSString *)event {

if ([self presentationLayer] != nil && [[self class] isCustomAnimationKey:event]) {
id animation = [super actionForKey:@"backgroundColor"];

if (animation == nil || [animation isEqual:[NSNull null]]) {
[self setNeedsDisplay];
return [NSNull null];
}
[animation setKeyPath:event];
[animation setFromValue:[self.presentationLayer valueForKey:event]];
[animation setToValue:nil];
return animation;
}

return [super actionForKey:event];
Expand Down
8 changes: 4 additions & 4 deletions Pod/Classes/MBCircularProgressBarView.m
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ -(CGFloat)emptyLineWidth{
}

-(void)setProgressColor:(UIColor*)color{
self.progressLayer.progressColor = color;
self.progressLayer.progressColor = color.CGColor;
}

-(UIColor*)progressColor{
return self.progressLayer.progressColor;
return [UIColor colorWithCGColor: self.progressLayer.progressColor];
}

-(void)setUnitFontSize:(CGFloat)unitFontSize{
Expand Down Expand Up @@ -171,11 +171,11 @@ -(UIColor*)fontColor{
}

-(void)setProgressStrokeColor:(UIColor*)color{
self.progressLayer.progressStrokeColor = color;
self.progressLayer.progressStrokeColor = color.CGColor;
}

-(UIColor*)progressStrokeColor{
return self.progressLayer.progressStrokeColor;
return [UIColor colorWithCGColor: self.progressLayer.progressStrokeColor];
}

-(void)setEmptyLineColor:(UIColor *)emptyLineColor{
Expand Down