Circular ProgressView for iOS with configuration for starting and end angle.
platform :ios, '7.0'
pod "MMCircularProgressView", "~> 1.0.1"
Drag into your project the folder /MMCircularProgressView
. That's all.
There's nothing to it! Firstly, import the .h :
#import "MMCircularProgressView.h"
Then declare it as a property if you want to access to it properly:
@property (nonatomic, strong) MMCircularProgressView *theProgressView;
Instantiate it and add it to the desired view as usual: (or create it through Interface Builder)
//creates and adds the datepicker at the edge of the application frame.
self.theProgressView = [[MMCircularProgressView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)];
[self.view addSubview:self.theProgressView];
It will go from 0.0 to 1.0.
[self.circularProgressView setProgress:0.5]; //this is a float value.
Simple as hell!
[self.circularProgressView startAnimation];
Here you can see a bunch of parameters that you can change:
- UIColor
progressColor
: Customize te progress Color. - UIColor
trackColor
: Customize the track Color.
- CGFloat
startAngle
: from 0 to 360 degrees. - CGFloat
endAngle
: from 0 to 360 degrees.
- CGFloat
initialProgress
: This will help you to determine where it should start the animation.
- BOOL
displayNeedle
: This will show or not the needle that you can see in the example image. - UIColor
needleColor
: Color of the needle.
- CGFloat
strokeWidth
: This is the width of the track. - CGFloat
duration
: This is the time for the animation from 0.0 to progress value.
Hope you enjoy it!