Minimal circular progress label
Minimal circular progress label for iOS
KAProgressLabel/KAProgressLabel
folder into your project.add this line to your Podfile : :
pod 'KAProgressLabel'
Have a look at the necessary code to display a progress label such as the one on top.
[_myProgressLabel setProgressColor:[UIColor blackColor]]; // black progress bar
[_myProgressLabel setTrackColor:[UIColor lightGrayColor]]; // gray track bar
[_myProgressLabel setFillColor:[UIColor clearColor]]; // transparent fill color
[_myProgressLabel setBorderWidth:5]; // 5px border
// Progress must be between 0 and 1
[_myProgressLabel setText:@"50%"];
[_myProgressLabel setProgress:(50/100)];
A delegate method is provided in order for you to change the content of the label according to your needs
- (void)viewDidLoad
{
[_myProgressLabel setDelegate:self];
[_myProgressLabel setProgress:(50/100)
withAnimation:TPPropertyAnimationTimingEaseOut
duration:1
afterDelay:0];
}
#pragma mark - delegate
- (void)progressLabel:(KAProgressLabel *)label progressChanged:(CGFloat)progress
{
[label setText:[NSString stringWithFormat:@"%.0f%%", (progress*100)]];
}
You may want to fine-tune yourself what arc to display or which way to draw it. Yo can use these methods to do so.
- (void) setStartDegree:(CGFloat)startDegree;
- (void) setEndDegree:(CGFloat)endDegree;
- (void) setClockWise:(BOOL)clockWise;