MatiBot / MBCircularProgressBar

A circular, animatable & highly customizable progress bar from the Interface Builder (Objective-C)
https://www.cocoacontrols.com/controls/mbcircularprogressbar
MIT License
994 stars 180 forks source link

Added support for animating progressColor & progressStrokeColor #71

Open LeoSnek opened 6 years ago

LeoSnek commented 6 years ago

I've added support to change progressColor & progressStrokeColor in an animation block.

This can be tested in MBViewController with the following animate body:

CGFloat newValue = 100.f - self.progressBar.value;
UIColor *newColor = (newValue < 50.f) ? [UIColor orangeColor] : [UIColor blueColor];

[UIView animateWithDuration:self.animatedSwitch.on * 1.f animations:^{
    self.progressBar.value = newValue;
    self.progressBar.progressColor = newColor;
    self.progressBar.progressStrokeColor = newColor;
}];

The declarations of both properties in MBCircularProgressBarView are unchanged as UIColors so this change won't break anyone's code.