该项目是一款仿照iOS 7 的蓝色圆形进度条视图。
动态图
安装方式
CocoaPods
1.将 pod ‘FFCircularProgressView’, ‘>= 0.1’ ?添加到你的Podfile中
2.运行 pod install ?安装pod
3.在你的项目中需要的地方import进程视图‘#import “FFCircularProgressView.h”’
手动添加
手动将源文件添加到你的项目中。你需要的文件是 ‘FFCircularProgressView.h’, ‘FFCircularProgressView.m’, ‘UIColor+iOS7.h’, ‘UIColor+iOS7.m’。
使用方法
把本项目当做一个正常的UIProgressView来使用。确保你在主要线程设置过进程值。
double delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND,0), ^{
for (float i=0; i<1.1; i+=0.01F) {
dispatch_async(dispatch_get_main_queue(), ^{
[circularProgressView setProgress:i];
});
usleep(10000);
}
});
});
还可以使用以下两种方法来启动和停止旋转从而控制进度视图旋转动画:
// Start spinning
[circularProgressView startSpinProgressBackgroundLayer];
// Stop spinning
[circularProgressView stopSpinProgressBackgroundLayer];