带有起始和结束角度配置的 iOS 圆形进度视图。
platform :ios, '7.0'
pod "MMCircularProgressView", "~> 1.0.1"
将文件夹 /MM圆角进度视图
拖入您的项目中。这就是全部。
没什么可做的!首先,导入 .h 文件
#import "MMCircularProgressView.h"
然后将其声明为属性,如果您想正确访问它
@property (nonatomic, strong) MMCircularProgressView *theProgressView;
实例化它并将其添加到所需的视图中,如通常操作:(或通过 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];
它将从 0.0 到 1.0。
[self.circularProgressView setProgress:0.5]; //this is a float value.
非常简单!
[self.circularProgressView startAnimation];
您可以看到一些可更改的参数
progressColor
:自定义进度颜色。trackColor
:自定义轨道颜色。startAngle
:从 0 到 360 度。endAngle
:从 0 到 360 度。initialProgress
:这将帮助您确定动画应该从何处开始。displayNeedle
:这将显示或隐藏您在示例图像中看到的指针。needleColor
:指针颜色。strokeWidth
:这是轨道的宽度。duration
:这是从 0.0 到进度值的动画时间。希望您喜欢它!