├── CircleProgressView ├── CircleProgressView.h └── CircleProgressView.m ├── ColorProgressView ├── ColorProgressView.h └── ColorProgressView.m ├── LoadProgressView ├── AiQIYiLoadProgerssView.h ├── AiQIYiLoadProgerssView.m ├── HemicycleLoadProgressView.h ├── HemicycleLoadProgressView.m ├── HemicycleLoadProgressView.temp_caseinsensitive_rename.h ├── LoadProgressView.h └── LoadProgressView.m ├── ProgressView.gif ├── ProgressView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── zhao.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── zhao.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ ├── ProgressView.xcscheme │ │ └── xcschememanagement.plist │ └── zhaosongbo.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ └── ProgressView.xcscheme ├── ProgressView ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── ProgressViewTests ├── Info.plist └── ProgressViewTests.m ├── ProgressViewUITests ├── Info.plist └── ProgressViewUITests.m ├── README.md └── WaveProgressView ├── WaveProgressView.h └── WaveProgressView.m /CircleProgressView/CircleProgressView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CircleProgressView.h 3 | // ProgressView 4 | // 5 | // Created by zhao on 16/9/13. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 正常的圆形进度条 8 | 9 | #import 10 | 11 | @protocol CircleProgressViewDelegate 12 | 13 | - (void)theCallbackOfClickCenterLabel; 14 | 15 | @end 16 | 17 | @interface CircleProgressView : UIView 18 | 19 | @property (nonatomic, strong) UIColor *progressColor; /**< 进度条颜色 默认红色*/ 20 | @property (nonatomic, strong) UIColor *progressBackgroundColor; /**< 进度条背景色 默认灰色*/ 21 | @property (nonatomic, assign) CGFloat progressWidth; /**< 进度条宽度 默认3*/ 22 | @property (nonatomic, assign) float percent; /**< 进度条进度 0-1*/ 23 | @property (nonatomic, assign) BOOL clockwise; /**< 0顺时针 1逆时针*/ 24 | 25 | @property (nonatomic, strong) UILabel *centerLabel; /**< 记录进度的Label*/ 26 | @property (nonatomic, strong) UIColor *labelbackgroundColor; /** delegate; /**< 点击中间label的回调*/ 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /CircleProgressView/CircleProgressView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CircleProgressView.m 3 | // ProgressView 4 | // 5 | // Created by zhao on 16/9/13. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 正常的圆形进度条 8 | 9 | #import "CircleProgressView.h" 10 | 11 | #define WIDTH self.frame.size.width 12 | #define HEIGHT self.frame.size.height 13 | 14 | @implementation CircleProgressView 15 | 16 | - (instancetype)initWithFrame:(CGRect)frame 17 | { 18 | if([super initWithFrame:frame]) 19 | { 20 | [self initData]; 21 | } 22 | return self; 23 | } 24 | 25 | - (instancetype)init 26 | { 27 | if([super init]) 28 | { 29 | [self initData]; 30 | } 31 | return self; 32 | } 33 | 34 | - (instancetype)initWithCoder:(NSCoder *)aDecoder 35 | { 36 | if([super initWithCoder:aDecoder]) 37 | { 38 | [self initData]; 39 | } 40 | return self; 41 | } 42 | 43 | /** 初始化数据*/ 44 | - (void)initData 45 | { 46 | self.progressWidth = 3.0; 47 | self.progressColor = [UIColor redColor]; 48 | self.progressBackgroundColor = [UIColor grayColor]; 49 | self.percent = 0.0; 50 | self.clockwise = 0; 51 | 52 | self.labelbackgroundColor = [UIColor clearColor]; 53 | self.textColor = [UIColor blackColor]; 54 | self.textFont = [UIFont systemFontOfSize:15]; 55 | } 56 | 57 | - (void)layoutSubviews 58 | { 59 | [super addSubview:self.centerLabel]; 60 | self.centerLabel.backgroundColor = self.labelbackgroundColor; 61 | self.centerLabel.textColor = self.textColor; 62 | self.centerLabel.font = self.textFont; 63 | [self addSubview:self.centerLabel]; 64 | } 65 | 66 | #pragma mark -- 画进度条 67 | 68 | - (void)drawRect:(CGRect)rect 69 | { 70 | CGContextRef context = UIGraphicsGetCurrentContext(); 71 | 72 | CGContextSetShouldAntialias(context, YES); // 平滑 73 | CGContextAddArc(context, WIDTH/2, HEIGHT/2, (WIDTH-self.progressWidth)/2, 0, M_PI*2, 0); 74 | [self.progressBackgroundColor setStroke]; 75 | CGContextSetLineWidth(context, self.progressWidth); 76 | CGContextStrokePath(context); 77 | 78 | if(self.percent) 79 | { 80 | CGFloat angle = 2 * self.percent * M_PI - M_PI_2; 81 | if(self.clockwise) {// 反方向 82 | CGContextAddArc(context, WIDTH/2, HEIGHT/2, (WIDTH-self.progressWidth)/2, ((int)self.percent == 1 ? -M_PI_2 : angle), -M_PI_2, 0); 83 | } 84 | else {// 正方向 85 | CGContextAddArc(context, WIDTH/2, HEIGHT/2, (WIDTH-self.progressWidth)/2, -M_PI_2, angle, 0); 86 | } 87 | [self.progressColor setStroke]; 88 | CGContextSetLineWidth(context, self.progressWidth); 89 | CGContextStrokePath(context); 90 | } 91 | } 92 | 93 | #pragma mark -- 中间label的点击事件 94 | 95 | - (void)touchCenterLabel:(UITapGestureRecognizer *)tap 96 | { 97 | if([self.delegate respondsToSelector:@selector(theCallbackOfClickCenterLabel)]) 98 | { 99 | [self.delegate theCallbackOfClickCenterLabel]; 100 | } 101 | } 102 | 103 | #pragma mark -- setter或getter 104 | 105 | - (void)setPercent:(float)percent 106 | { 107 | if(self.percent < 0) return; 108 | _percent = percent; 109 | 110 | [self setNeedsDisplay]; 111 | } 112 | 113 | - (UILabel *)centerLabel 114 | { 115 | if(!_centerLabel) 116 | { 117 | _centerLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.progressWidth + 5, 0, WIDTH - (self.progressWidth +5) * 2, HEIGHT/2)]; 118 | _centerLabel.center = CGPointMake(WIDTH/2, HEIGHT/2); 119 | _centerLabel.textAlignment = NSTextAlignmentCenter; 120 | _centerLabel.userInteractionEnabled = YES; 121 | _centerLabel.layer.cornerRadius = 5.0; 122 | _centerLabel.clipsToBounds = YES; 123 | [_centerLabel addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(touchCenterLabel:)]]; 124 | } 125 | return _centerLabel; 126 | } 127 | 128 | @end 129 | -------------------------------------------------------------------------------- /ColorProgressView/ColorProgressView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ColorProgressView.h 3 | // ProgressView 4 | // 5 | // Created by zhao on 16/9/18. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 颜色进度条 根据滑动的位置不同返回不同的颜色 8 | 9 | #import 10 | 11 | @interface ColorProgressView : UIView 12 | 13 | @property (nonatomic, strong) NSArray *upColors; /**< 上半部分颜色 CGColor*/ 14 | @property (nonatomic, strong) NSArray *downColors; /**< 下半部分颜色 CGColor*/ 15 | @property (nonatomic, assign) CGFloat progressWidth; /**< 进度条宽度 默认6.0*/ 16 | @property (nonatomic, strong) UIColor *centerCircleColor; /**< 中间圆的背景色 默认白色*/ 17 | 18 | /** 19 | * 根据拖拽时按钮的point 获取颜色按钮在的center(center在圆上) 20 | * 21 | * @param btnPoint 拖拽是按钮的point 22 | * @param centerOfCircle 圆心的坐标 (父视图上的,因为btn是放在self.view的) 23 | * 24 | * @return 圆上的center 25 | */ 26 | - (CGPoint)getColorBtnCenterWithDragBtnPoint:(CGPoint)btnPoint centerOfCircle:(CGPoint)centerOfCircle; 27 | 28 | /** 29 | * 根据按钮拖动的位置 返回圆上对应位置的颜色 30 | */ 31 | - (UIColor *)colorWithCirclePoint:(CGPoint)btnPoint; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /ColorProgressView/ColorProgressView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ColorProgressView.m 3 | // ProgressView 4 | // 5 | // Created by zhao on 16/9/18. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 8 | 9 | #import "ColorProgressView.h" 10 | 11 | #define COLOR_WIDTH self.frame.size.width 12 | #define COLOR_HEIGHT self.frame.size.height 13 | @interface ColorProgressView () 14 | 15 | @property (nonatomic, strong) CAGradientLayer *gradientLayer; /**< 颜色渐变层*/ 16 | 17 | @end 18 | 19 | 20 | @implementation ColorProgressView 21 | 22 | - (instancetype)initWithFrame:(CGRect)frame 23 | { 24 | if([super initWithFrame:frame]) 25 | { 26 | [self initData]; 27 | } 28 | return self; 29 | } 30 | 31 | - (instancetype)init 32 | { 33 | if([super init]) 34 | { 35 | [self initData]; 36 | } 37 | return self; 38 | } 39 | 40 | - (instancetype)initWithCoder:(NSCoder *)aDecoder 41 | { 42 | if([super initWithCoder:aDecoder]) 43 | { 44 | [self initData]; 45 | } 46 | return self; 47 | } 48 | 49 | - (void)setProgressWidth:(CGFloat)progressWidth 50 | { 51 | _progressWidth = progressWidth; 52 | } 53 | 54 | /** 初始化数据*/ 55 | - (void)initData 56 | { 57 | if(COLOR_HEIGHT != COLOR_WIDTH){ 58 | NSLog(@"宽和高不一样,裁剪出来的不是圆"); 59 | return; 60 | } 61 | self.backgroundColor = [UIColor whiteColor]; 62 | self.layer.masksToBounds = YES; 63 | self.layer.cornerRadius = COLOR_WIDTH/2; 64 | 65 | self.progressWidth = 6.0; 66 | self.upColors = @[(id)[UIColor blueColor].CGColor, (id)[UIColor redColor].CGColor, (id)[UIColor yellowColor].CGColor]; 67 | self.downColors = @[(id)[UIColor greenColor].CGColor, (id)[UIColor cyanColor].CGColor, (id)[UIColor purpleColor].CGColor]; 68 | self.centerCircleColor = [UIColor whiteColor]; 69 | } 70 | 71 | - (void)layoutSubviews 72 | { 73 | [super layoutSubviews]; 74 | [self setupMultipleColor]; 75 | } 76 | 77 | // 采用dreaRect中直接画渐变颜色圆,颜色不会随着线条渐变 会对称显示 78 | //- (void)drawRect:(CGRect)rect 79 | //{ 80 | // CGContextRef context = UIGraphicsGetCurrentContext(); 81 | // 82 | // // 画圆 83 | // CGContextAddArc(context, COLOR_WIDTH*0.5, COLOR_HEIGHT*0.5, COLOR_HEIGHT*0.5 - self.progressWidth, 0, M_PI*2, 0); 84 | // CGContextSetLineCap(context, kCGLineCapRound); 85 | // CGContextSetLineWidth(context, self.progressWidth); 86 | // 87 | // // 颜色渐变器 88 | // CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 89 | // CGGradientRef grandient = CGGradientCreateWithColors(colorSpace, (CFArrayRef)self.circleColors, NULL); 90 | // CGColorSpaceRelease(colorSpace); 91 | // 92 | // CGContextReplacePathWithStrokedPath(context); 93 | // CGContextClip(context); 94 | // CGContextDrawLinearGradient(context, grandient, CGPointMake(0, COLOR_HEIGHT*0.5), CGPointMake(COLOR_WIDTH, COLOR_HEIGHT*0.5), kCGGradientDrawsAfterEndLocation); 95 | // CGGradientRelease(grandient); 96 | //} 97 | 98 | 99 | /** 100 | * 将view分成上下两部分,并赋给多种颜色 101 | */ 102 | - (void)setupMultipleColor 103 | { 104 | // 上半部分 105 | CAGradientLayer *upLayer = [CAGradientLayer layer]; 106 | upLayer.frame = CGRectMake(0, 0, COLOR_WIDTH, COLOR_HEIGHT/2); 107 | // 颜色渐变方向 108 | upLayer.startPoint = CGPointMake(0, 0.5); 109 | upLayer.endPoint = CGPointMake(1, 0.5); 110 | // 颜色 111 | upLayer.colors = self.upColors; 112 | [self.layer addSublayer:upLayer]; 113 | 114 | // 下半部分 115 | CAGradientLayer *downLayer = [CAGradientLayer layer]; 116 | downLayer.frame = CGRectMake(0, COLOR_HEIGHT/2, COLOR_WIDTH, COLOR_HEIGHT/2); 117 | // 颜色渐变方向 118 | downLayer.startPoint = CGPointMake(0, 0.5); 119 | downLayer.endPoint = CGPointMake(1, 0.5); 120 | downLayer.colors = self.downColors; 121 | [self.layer addSublayer:downLayer]; 122 | 123 | // 中心圆 白色 124 | UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(COLOR_WIDTH/2, COLOR_HEIGHT/2) radius:(COLOR_WIDTH-self.progressWidth*2)/2 startAngle:0 endAngle:M_PI*2 clockwise:0]; 125 | 126 | CAShapeLayer *circleLayer = [CAShapeLayer layer]; 127 | circleLayer.lineCap = kCALineCapRound; 128 | circleLayer.lineWidth = self.progressWidth; 129 | circleLayer.fillColor = self.centerCircleColor.CGColor; 130 | circleLayer.path = path.CGPath; 131 | [self.layer addSublayer:circleLayer]; 132 | 133 | 134 | // CAShapeLayer *colorLayer = [CAShapeLayer layer]; 135 | // colorLayer.lineWidth = self.progressWidth; 136 | // colorLayer.fillColor = [UIColor clearColor]; 137 | // colorLayer.strokeColor = [UIColor redColor].CGColor; 138 | // 139 | // [self.layer addSublayer:colorLayer]; 140 | // colorLayer.path = path.CGPath; 141 | // self.gradientLayer.mask = colorLayer; 142 | } 143 | 144 | #pragma mark -- 转换坐标 145 | 146 | // 这里要注意 有时拖拽按钮不在圆上,但是只要算出拖拽点与圆心的连线和水平方向的夹角的余弦值,再乘上半径,就是我们想要的值 147 | - (CGPoint)getColorBtnCenterWithDragBtnPoint:(CGPoint)btnPoint centerOfCircle:(CGPoint)centerOfCircle 148 | { 149 | CGFloat radius = (COLOR_WIDTH - self.progressWidth)/2; //半径 150 | 151 | // 拖拽点(实际)坐标到圆心的距离的平方 勾股定理 152 | CGFloat squareDis = (centerOfCircle.x - btnPoint.x)*(centerOfCircle.x - btnPoint.x) + (centerOfCircle.y -btnPoint.y)*(centerOfCircle.y - btnPoint.y); 153 | // 拖拽点坐标到圆心的距离 154 | // 注意拖拽点与圆心重合的情况 这时squareDis趋近或等于0 作为分母会crash 155 | CGFloat distance = MAX(0.1, fabs(sqrt(squareDis))); 156 | 157 | // 拖拽点与圆心的连线 与水平方向夹角的余弦值 158 | CGFloat cosX = fabs(centerOfCircle.x - btnPoint.x) / distance; 159 | 160 | // 拖拽点(虚拟)在圆上到圆心的X值, y值 161 | CGFloat centerX = cosX * radius; 162 | CGFloat centerY = sqrt(radius*radius - centerX*centerX); 163 | 164 | // 算出在父视图上的实际X值、Y值 165 | if(btnPoint.x > centerOfCircle.x){ // 拖拽点在圆心右边 166 | centerX = centerOfCircle.x + centerX; 167 | } 168 | else{ // 拖拽点在圆心左边 169 | centerX = centerOfCircle.x - centerX; 170 | } 171 | 172 | if(btnPoint.y > centerOfCircle.y) { // 拖拽点在圆心下边 173 | centerY = centerOfCircle.y + centerY; 174 | } 175 | else{// 拖拽点在圆心上边 176 | centerY = centerOfCircle.y - centerY; 177 | } 178 | return CGPointMake(centerX, centerY); 179 | } 180 | 181 | #pragma mark -- 根据坐标返回颜色 182 | 183 | - (UIColor *)colorWithCirclePoint:(CGPoint)circlePoint 184 | { 185 | unsigned char pixel[4] = {0}; 186 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 187 | CGContextRef context = CGBitmapContextCreate(pixel, 1, 1, 8, 4, colorSpace, (CGBitmapInfo)kCGImageAlphaPremultipliedLast); 188 | 189 | CGContextTranslateCTM(context, -circlePoint.x, -circlePoint.y); 190 | //NSLog(@"%f, %f", circlePoint.x, circlePoint.y); 191 | [self.layer renderInContext:context]; 192 | 193 | CGContextRelease(context); 194 | CGColorSpaceRelease(colorSpace); 195 | 196 | //NSLog(@"%@", [UIColor colorWithRed:pixel[0]/255.0 green:pixel[1]/255.0 blue:pixel[2]/255.0 alpha:pixel[3]/255.0]); 197 | return [UIColor colorWithRed:pixel[0]/255.0 green:pixel[1]/255.0 blue:pixel[2]/255.0 alpha:pixel[3]/255.0]; 198 | } 199 | 200 | 201 | #pragma mark -- getter 202 | 203 | - (CAGradientLayer *)gradientLayer 204 | { 205 | if (!_gradientLayer) 206 | { 207 | _gradientLayer = [[CAGradientLayer alloc] init]; 208 | _gradientLayer.frame = self.bounds; 209 | _gradientLayer.colors = self.upColors; 210 | 211 | _gradientLayer.locations = @[@(0), @(0.4), @(0.8)]; 212 | _gradientLayer.startPoint = CGPointMake(0, 0); 213 | _gradientLayer.endPoint = CGPointMake(1, 0); 214 | _gradientLayer.type = kCAGradientLayerAxial; 215 | [self.layer addSublayer:_gradientLayer]; 216 | } 217 | return _gradientLayer; 218 | } 219 | 220 | @end 221 | -------------------------------------------------------------------------------- /LoadProgressView/AiQIYiLoadProgerssView.h: -------------------------------------------------------------------------------- 1 | // 2 | // AiQIYiLoadProgerss.h 3 | // ProgressView 4 | // 5 | // Created by zhaoName on 2017/3/16. 6 | // Copyright © 2017年 zhaoName. All rights reserved. 7 | // 彷爱奇艺加载进度条 8 | 9 | #import 10 | 11 | @interface AiQIYiLoadProgerssView : UIView 12 | 13 | @property (nonatomic, assign) CGFloat animationDuration; /**<动画持续时长 默认1秒*/ 14 | @property (nonatomic, assign) CGFloat progressWidth; /**< 进度条宽度 默认2.0*/ 15 | @property (nonatomic, strong) UIColor *progressColor; /**< 进度条颜色 默认红色*/ 16 | 17 | /** 18 | * 添加通知 当程序重新进入前台或活跃状态,动画仍然会执行 19 | */ 20 | - (void)addNotificationObserver; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /LoadProgressView/AiQIYiLoadProgerssView.m: -------------------------------------------------------------------------------- 1 | // 2 | // AiQIYiLoadProgerss.m 3 | // ProgressView 4 | // 5 | // Created by zhaoName on 2017/3/16. 6 | // Copyright © 2017年 zhaoName. All rights reserved. 7 | // 彷爱奇艺加载进度条 8 | 9 | #import "AiQIYiLoadProgerssView.h" 10 | 11 | #define AIQIYI_LOAD_WIDTH self.frame.size.width 12 | #define AIQIYI_LOAD_HEIGHT self.frame.size.height 13 | 14 | @interface AiQIYiLoadProgerssView () 15 | 16 | @property (nonatomic, strong) CAShapeLayer *shapeLayer; /**< */ 17 | 18 | @end 19 | 20 | @implementation AiQIYiLoadProgerssView 21 | 22 | - (instancetype)initWithFrame:(CGRect)frame 23 | { 24 | if([super initWithFrame:frame]) 25 | { 26 | [self initData]; 27 | } 28 | return self; 29 | } 30 | 31 | - (instancetype)init 32 | { 33 | if([super init]) 34 | { 35 | [self initData]; 36 | } 37 | return self; 38 | } 39 | 40 | - (instancetype)initWithCoder:(NSCoder *)aDecoder 41 | { 42 | if([super initWithCoder:aDecoder]) 43 | { 44 | [self initData]; 45 | } 46 | return self; 47 | } 48 | 49 | #pragma mark -- 初始化数据 50 | 51 | /** 初始化数据*/ 52 | - (void)initData 53 | { 54 | self.backgroundColor = [UIColor whiteColor]; 55 | self.animationDuration = 1.5; 56 | self.progressWidth = 2.0; 57 | self.progressColor = [UIColor redColor]; 58 | } 59 | 60 | - (void)layoutSubviews 61 | { 62 | [super layoutSubviews]; 63 | [self addAnimation]; 64 | } 65 | 66 | #pragma mark -- 进度条 67 | 68 | - (void)drawRect:(CGRect)rect 69 | { 70 | if(AIQIYI_LOAD_WIDTH != AIQIYI_LOAD_HEIGHT) return; 71 | // 画背景圆 72 | // UIBezierPath *cyclePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(AIQIYI_LOAD_WIDTH * 0.5, AIQIYI_LOAD_HEIGHT * 0.5) radius:(AIQIYI_LOAD_WIDTH - self.progressWidth) * 0.5 startAngle:0 endAngle:M_PI * 2 clockwise:YES]; 73 | // [cyclePath setLineWidth:self.progressWidth]; 74 | // [cyclePath stroke]; 75 | 76 | // 画三角形 77 | UIBezierPath *trianglePath = [UIBezierPath bezierPath]; 78 | CGFloat triangleHeight = AIQIYI_LOAD_WIDTH / 3.0; 79 | [trianglePath moveToPoint:CGPointMake(triangleHeight * 2 + self.progressWidth, AIQIYI_LOAD_HEIGHT * 0.5)]; 80 | [trianglePath addLineToPoint:CGPointMake(triangleHeight + self.progressWidth, AIQIYI_LOAD_HEIGHT * 0.5 - triangleHeight * 0.5)]; 81 | [trianglePath addLineToPoint:CGPointMake(triangleHeight + self.progressWidth, AIQIYI_LOAD_HEIGHT * 0.5 + triangleHeight * 0.5)]; 82 | 83 | [self.progressColor setFill]; 84 | [trianglePath fill]; 85 | } 86 | 87 | - (void)addAnimation 88 | { 89 | [self.layer removeAllAnimations]; 90 | // 添加旋转动画 91 | CABasicAnimation *rotationAni = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; 92 | 93 | rotationAni.duration = self.animationDuration; 94 | rotationAni.fromValue = 0; 95 | rotationAni.toValue = @(M_PI *2); 96 | rotationAni.repeatCount = MAXFLOAT; 97 | rotationAni.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 98 | 99 | [self.layer addAnimation:rotationAni forKey:@"rotation"]; 100 | 101 | // strokeEnd 正向画出路径 102 | CABasicAnimation *endAni = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; 103 | endAni.fromValue = @0.0; 104 | endAni.toValue = @1.0; 105 | endAni.duration = self.animationDuration; 106 | endAni.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; 107 | 108 | // strokeStart 反向清除路径 109 | CABasicAnimation *startAni = [CABasicAnimation animationWithKeyPath:@"strokeStart"]; 110 | startAni.fromValue = @0.0; 111 | startAni.toValue = @1.0; 112 | startAni.duration = self.animationDuration; 113 | startAni.beginTime = self.animationDuration; 114 | startAni.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; 115 | 116 | CAAnimationGroup *group = [CAAnimationGroup animation]; 117 | group.animations = @[endAni, startAni]; 118 | group.repeatCount = MAXFLOAT; 119 | group.fillMode = kCAFillModeForwards; 120 | group.duration = 2*self.animationDuration; 121 | // 上面的正向画出路径和反向清楚路径动画 是根据你画图是的起点来的 122 | UIBezierPath *cyclePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(AIQIYI_LOAD_WIDTH * 0.5, AIQIYI_LOAD_HEIGHT * 0.5) radius:(AIQIYI_LOAD_WIDTH - self.progressWidth) * 0.5 startAngle:-M_PI_2 endAngle:M_PI_2 * 3 clockwise:YES]; 123 | self.shapeLayer.path = cyclePath.CGPath; 124 | 125 | [self.shapeLayer addAnimation:group forKey:@"group"]; 126 | [self.layer addSublayer:self.shapeLayer]; 127 | } 128 | 129 | #pragma mark -- 进入前台或活跃状态 130 | 131 | // 当程序重新进入前台或活跃状态,动画仍然会执行 132 | - (void)addNotificationObserver 133 | { 134 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addAnimation) name:UIApplicationDidBecomeActiveNotification object:nil]; 135 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addAnimation) name:UIApplicationWillEnterForegroundNotification object:nil]; 136 | } 137 | 138 | - (void)dealloc 139 | { 140 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 141 | } 142 | 143 | #pragma mark -- getter 144 | 145 | - (CAShapeLayer *)shapeLayer 146 | { 147 | if(!_shapeLayer) 148 | { 149 | _shapeLayer = [CAShapeLayer layer]; 150 | _shapeLayer.lineCap = kCALineCapRound; 151 | _shapeLayer.lineWidth = self.progressWidth; 152 | _shapeLayer.strokeColor = self.progressColor.CGColor; 153 | _shapeLayer.fillColor = [UIColor clearColor].CGColor; 154 | } 155 | return _shapeLayer; 156 | } 157 | 158 | @end 159 | -------------------------------------------------------------------------------- /LoadProgressView/HemicycleLoadProgressView.h: -------------------------------------------------------------------------------- 1 | // 2 | // hemicycleLoadProgressView.h 3 | // ProgressView 4 | // 5 | // Created by zhao on 16/10/24. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HemicycleLoadProgressView : UIView 12 | 13 | 14 | @property (nonatomic, assign) CGFloat animationDuration; /**<动画持续时长*/ 15 | @property (nonatomic, assign) CGFloat progressWidth; /**< 进度条宽度 默认3*/ 16 | @property (nonatomic, strong) UIColor *progressColor; /**< 进度条颜色 默认红色*/ 17 | @property (nonatomic, strong) UIColor *progressBackgroundColor; /**< 进度条背景色 默认灰色*/ 18 | @property (nonatomic, assign) BOOL clockwise; /**< 0顺时针 1逆时针*/ 19 | 20 | 21 | /** 22 | * 添加通知 当程序重新进入前台或活跃状态,动画仍然会执行 23 | */ 24 | - (void)addNotificationObserver; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /LoadProgressView/HemicycleLoadProgressView.m: -------------------------------------------------------------------------------- 1 | // 2 | // hemicycleLoadProgressView.m 3 | // ProgressView 4 | // 5 | // Created by zhao on 16/10/24. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 8 | 9 | #import "HemicycleLoadProgressView.h" 10 | 11 | #define LOAD_WIDTH self.frame.size.width 12 | #define LOAD_HEIGHT self.frame.size.height 13 | 14 | @interface HemicycleLoadProgressView () 15 | 16 | @property (nonatomic, strong) CAShapeLayer *shapeLayer; 17 | 18 | @end 19 | 20 | @implementation HemicycleLoadProgressView 21 | 22 | - (instancetype)initWithFrame:(CGRect)frame 23 | { 24 | if([super initWithFrame:frame]) 25 | { 26 | [self initData]; 27 | } 28 | return self; 29 | } 30 | 31 | - (instancetype)init 32 | { 33 | if([super init]) 34 | { 35 | [self initData]; 36 | } 37 | return self; 38 | } 39 | 40 | - (instancetype)initWithCoder:(NSCoder *)aDecoder 41 | { 42 | if([super initWithCoder:aDecoder]) 43 | { 44 | [self initData]; 45 | } 46 | return self; 47 | } 48 | 49 | /** 初始化数据*/ 50 | - (void)initData 51 | { 52 | self.backgroundColor = [UIColor whiteColor]; 53 | 54 | self.animationDuration = 1.0; 55 | self.progressWidth = 2.0; 56 | self.progressColor = [UIColor redColor]; 57 | self.progressBackgroundColor = [UIColor grayColor]; 58 | self.clockwise = YES; 59 | } 60 | 61 | - (void)layoutSubviews 62 | { 63 | [super layoutSubviews]; 64 | [self setupLoadProgress]; 65 | } 66 | 67 | #pragma mark -- 进度条 68 | 69 | - (void)drawRect:(CGRect)rect 70 | { 71 | // 画背景圆 72 | UIBezierPath *path =[UIBezierPath bezierPathWithArcCenter:CGPointMake(LOAD_WIDTH/2, LOAD_HEIGHT/2) radius:(LOAD_WIDTH - self.progressWidth)/2.0 startAngle:0 endAngle:M_PI * 2 clockwise:YES]; 73 | [self.progressBackgroundColor setStroke]; 74 | path.lineWidth = self.progressWidth; 75 | [path stroke]; 76 | } 77 | 78 | - (void)setupLoadProgress 79 | { 80 | [self.layer removeAllAnimations]; 81 | // 添加动画效果 82 | CABasicAnimation *rotationAn = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; 83 | rotationAn.duration = self.animationDuration; 84 | rotationAn.fromValue = @0.0; 85 | rotationAn.toValue = @(2 * M_PI); 86 | rotationAn.repeatCount = MAXFLOAT; 87 | rotationAn.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; 88 | [self.layer addAnimation:rotationAn forKey:@"rotation"]; 89 | 90 | // 画弧度 YES逆时针 NO顺时针 91 | UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(LOAD_WIDTH/2, LOAD_HEIGHT/2) radius:(LOAD_WIDTH - self.progressWidth)/2.0 startAngle:-M_PI_4 endAngle:M_PI_4 clockwise:self.clockwise]; 92 | self.shapeLayer.path = path.CGPath; 93 | [self.layer addSublayer:self.shapeLayer]; 94 | } 95 | 96 | #pragma mark -- 进入前台或活跃状态 97 | 98 | // 当程序重新进入前台或活跃状态,动画仍然会执行 99 | - (void)addNotificationObserver 100 | { 101 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setupLoadProgress) name:UIApplicationDidBecomeActiveNotification object:nil]; 102 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setupLoadProgress) name:UIApplicationWillEnterForegroundNotification object:nil]; 103 | } 104 | 105 | - (void)dealloc 106 | { 107 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 108 | } 109 | 110 | #pragma mark -- getter 111 | 112 | - (CAShapeLayer *)shapeLayer 113 | { 114 | if(!_shapeLayer) 115 | { 116 | _shapeLayer = [CAShapeLayer layer]; 117 | _shapeLayer.lineCap = kCALineCapRound; 118 | _shapeLayer.lineWidth = self.progressWidth; 119 | _shapeLayer.strokeColor = self.progressColor.CGColor; 120 | _shapeLayer.fillColor = [UIColor clearColor].CGColor; 121 | } 122 | return _shapeLayer; 123 | } 124 | 125 | @end 126 | -------------------------------------------------------------------------------- /LoadProgressView/HemicycleLoadProgressView.temp_caseinsensitive_rename.h: -------------------------------------------------------------------------------- 1 | // 2 | // hemicycleLoadProgressView.h 3 | // ProgressView 4 | // 5 | // Created by zhao on 16/10/24. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HemicycleLoadProgressView : UIView 12 | 13 | 14 | @property (nonatomic, assign) CGFloat animationDuration; /**<动画持续时长*/ 15 | @property (nonatomic, assign) CGFloat progressWidth; /**< 进度条宽度 默认3*/ 16 | @property (nonatomic, strong) UIColor *progressColor; /**< 进度条颜色 默认红色*/ 17 | @property (nonatomic, strong) UIColor *progressBackgroundColor; /**< 进度条背景色 默认灰色*/ 18 | @property (nonatomic, assign) BOOL clockwise; /**< 0顺时针 1逆时针*/ 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /LoadProgressView/LoadProgressView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LoadProgressView.h 3 | // ProgressView 4 | // 5 | // Created by zhao on 16/9/18. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 加载进度条 8 | 9 | #import 10 | 11 | @interface LoadProgressView : UIView 12 | 13 | @property (nonatomic, assign) CGFloat animationDuration; /**<动画持续时长*/ 14 | @property (nonatomic, assign) CGFloat progressWidth; /**< 进度条宽度*/ 15 | @property (nonatomic, strong) NSArray *progressColors; /**< 进度条颜色*/ 16 | 17 | /** 18 | * 添加通知 当程序重新进入前台或活跃状态,动画仍然会执行 19 | */ 20 | - (void)addNotificationObserver; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /LoadProgressView/LoadProgressView.m: -------------------------------------------------------------------------------- 1 | // 2 | // LoadProgressView.m 3 | // ProgressView 4 | // 5 | // Created by zhao on 16/9/18. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 8 | 9 | #import "LoadProgressView.h" 10 | 11 | #define LOAD_WIDTH self.frame.size.width 12 | #define LOAD_HEIGHT self.frame.size.height 13 | 14 | @interface LoadProgressView () 15 | 16 | @property (nonatomic, strong) CAShapeLayer *shapeLayer; 17 | @property (nonatomic, strong) NSTimer *timer; 18 | 19 | @end 20 | 21 | @implementation LoadProgressView 22 | 23 | - (instancetype)initWithFrame:(CGRect)frame 24 | { 25 | if([super initWithFrame:frame]) 26 | { 27 | [self initData]; 28 | } 29 | return self; 30 | } 31 | 32 | - (instancetype)init 33 | { 34 | if([super init]) 35 | { 36 | [self initData]; 37 | } 38 | return self; 39 | } 40 | 41 | - (instancetype)initWithCoder:(NSCoder *)aDecoder 42 | { 43 | if([super initWithCoder:aDecoder]) 44 | { 45 | [self initData]; 46 | } 47 | return self; 48 | } 49 | 50 | /** 初始化数据*/ 51 | - (void)initData 52 | { 53 | self.animationDuration = 1.0; 54 | self.progressWidth = 3.0; 55 | self.progressColors = @[[UIColor darkGrayColor]]; 56 | } 57 | 58 | - (void)layoutSubviews 59 | { 60 | [super layoutSubviews]; 61 | [self setupLoadProgress]; 62 | } 63 | 64 | #pragma mark -- 进度条 65 | 66 | - (void)setupLoadProgress 67 | { 68 | // 断言 当前面的表达式为假值时 打印后面的内容 但是程序还是会崩溃 69 | NSAssert(self.progressWidth > 0.0, @"进度条宽度必须大于0"); 70 | NSAssert(self.progressColors.count > 0, @"重置的颜色数组不能为空"); 71 | 72 | [self.layer removeAllAnimations]; 73 | [self addAnimation]; 74 | 75 | if(!self.timer && self.progressColors.count > 1){ 76 | self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(changeProgressColor:) userInfo:nil repeats:YES]; 77 | } 78 | } 79 | 80 | - (void)addAnimation 81 | { 82 | // 绕z轴旋转 使每次重合的位置不同 83 | CABasicAnimation *rotationAni = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; 84 | rotationAni.fromValue = @0.0; 85 | rotationAni.toValue = @(2 * M_PI); 86 | rotationAni.duration = 3; 87 | rotationAni.repeatCount = MAXFLOAT; 88 | [self.layer addAnimation:rotationAni forKey:@"roration"]; 89 | 90 | // strokeEnd 正向画出路径 91 | CABasicAnimation *endAni = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; 92 | endAni.fromValue = @0.0; 93 | endAni.toValue = @1.0; 94 | endAni.duration = self.animationDuration; 95 | endAni.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; 96 | 97 | // strokeStart 反向清除路径 98 | CABasicAnimation *startAni = [CABasicAnimation animationWithKeyPath:@"strokeStart"]; 99 | startAni.fromValue = @0.0; 100 | startAni.toValue = @1.0; 101 | startAni.duration = self.animationDuration; 102 | startAni.beginTime = 1.0; 103 | startAni.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 104 | 105 | CAAnimationGroup *group = [CAAnimationGroup animation]; 106 | group.animations = @[endAni, startAni]; 107 | group.repeatCount = MAXFLOAT; 108 | group.fillMode = kCAFillModeForwards; 109 | group.duration = 2*self.animationDuration; 110 | 111 | UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(self.progressWidth, self.progressWidth, LOAD_WIDTH-self.progressWidth*2, LOAD_HEIGHT-self.progressWidth*2)]; 112 | self.shapeLayer.path = path.CGPath; 113 | 114 | [self.shapeLayer addAnimation:group forKey:@"group"]; 115 | [self.layer addSublayer:self.shapeLayer]; 116 | } 117 | 118 | /** 119 | * 随机改变进度条的颜色 120 | */ 121 | - (void)changeProgressColor:(NSTimer *)timer 122 | { 123 | CGColorRef color = [self.progressColors[arc4random()%self.progressColors.count] CGColor]; 124 | self.shapeLayer.strokeColor = color; 125 | } 126 | 127 | #pragma mark -- 进入前台或活跃状态 128 | 129 | // 当程序重新进入前台或活跃状态,动画仍然会执行 130 | - (void)addNotificationObserver 131 | { 132 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addAnimation) name:UIApplicationDidBecomeActiveNotification object:nil]; 133 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addAnimation) name:UIApplicationWillEnterForegroundNotification object:nil]; 134 | } 135 | 136 | - (void)dealloc 137 | { 138 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 139 | [self.timer invalidate]; 140 | self.timer = nil; 141 | } 142 | 143 | #pragma mark -- getter 144 | 145 | - (CAShapeLayer *)shapeLayer 146 | { 147 | if(!_shapeLayer) 148 | { 149 | _shapeLayer = [CAShapeLayer layer]; 150 | _shapeLayer.lineCap = kCALineCapRound; 151 | _shapeLayer.lineWidth = self.progressWidth; 152 | _shapeLayer.strokeColor = ((UIColor *)self.progressColors[0]).CGColor; 153 | _shapeLayer.fillColor = [UIColor clearColor].CGColor; 154 | _shapeLayer.strokeStart = 0.0; 155 | _shapeLayer.strokeEnd = 1.0; 156 | } 157 | return _shapeLayer; 158 | } 159 | 160 | @end 161 | -------------------------------------------------------------------------------- /ProgressView.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaoName/ProgressView/4135534abf88b865bc18bfb2cae0021cffe0d45f/ProgressView.gif -------------------------------------------------------------------------------- /ProgressView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 7046FA8A1E824B6E004BAE09 /* AiQIYiLoadProgerssView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7046FA891E824B6E004BAE09 /* AiQIYiLoadProgerssView.m */; }; 11 | FE5189F61D8E734100631DDE /* LoadProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = FE5189F51D8E734100631DDE /* LoadProgressView.m */; }; 12 | FE5189FA1D8E9FFB00631DDE /* ColorProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = FE5189F91D8E9FFB00631DDE /* ColorProgressView.m */; }; 13 | FEB419F51D87CB7800848D87 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = FEB419F41D87CB7800848D87 /* main.m */; }; 14 | FEB419F81D87CB7800848D87 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FEB419F71D87CB7800848D87 /* AppDelegate.m */; }; 15 | FEB419FB1D87CB7800848D87 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FEB419FA1D87CB7800848D87 /* ViewController.m */; }; 16 | FEB419FE1D87CB7800848D87 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FEB419FC1D87CB7800848D87 /* Main.storyboard */; }; 17 | FEB41A001D87CB7800848D87 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FEB419FF1D87CB7800848D87 /* Assets.xcassets */; }; 18 | FEB41A031D87CB7800848D87 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FEB41A011D87CB7800848D87 /* LaunchScreen.storyboard */; }; 19 | FEB41A0E1D87CB7800848D87 /* ProgressViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FEB41A0D1D87CB7800848D87 /* ProgressViewTests.m */; }; 20 | FEB41A191D87CB7800848D87 /* ProgressViewUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = FEB41A181D87CB7800848D87 /* ProgressViewUITests.m */; }; 21 | FEB41A2A1D87CE2E00848D87 /* CircleProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEB41A291D87CE2E00848D87 /* CircleProgressView.m */; }; 22 | FEB41A2D1D87CE4800848D87 /* WaveProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEB41A2C1D87CE4800848D87 /* WaveProgressView.m */; }; 23 | FEC312F81DBD9DF30025D96C /* HemicycleLoadProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC312F71DBD9DF30025D96C /* HemicycleLoadProgressView.m */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | FEB41A0A1D87CB7800848D87 /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = FEB419E81D87CB7800848D87 /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = FEB419EF1D87CB7800848D87; 32 | remoteInfo = ProgressView; 33 | }; 34 | FEB41A151D87CB7800848D87 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = FEB419E81D87CB7800848D87 /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = FEB419EF1D87CB7800848D87; 39 | remoteInfo = ProgressView; 40 | }; 41 | /* End PBXContainerItemProxy section */ 42 | 43 | /* Begin PBXFileReference section */ 44 | 7046FA891E824B6E004BAE09 /* AiQIYiLoadProgerssView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AiQIYiLoadProgerssView.m; sourceTree = ""; }; 45 | 7046FA8B1E824B80004BAE09 /* AiQIYiLoadProgerssView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AiQIYiLoadProgerssView.h; sourceTree = ""; }; 46 | FE5189F41D8E734100631DDE /* LoadProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadProgressView.h; sourceTree = ""; }; 47 | FE5189F51D8E734100631DDE /* LoadProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoadProgressView.m; sourceTree = ""; }; 48 | FE5189F81D8E9FFB00631DDE /* ColorProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorProgressView.h; sourceTree = ""; }; 49 | FE5189F91D8E9FFB00631DDE /* ColorProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ColorProgressView.m; sourceTree = ""; }; 50 | FEB419F01D87CB7800848D87 /* ProgressView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ProgressView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | FEB419F41D87CB7800848D87 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | FEB419F61D87CB7800848D87 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 53 | FEB419F71D87CB7800848D87 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 54 | FEB419F91D87CB7800848D87 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 55 | FEB419FA1D87CB7800848D87 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 56 | FEB419FD1D87CB7800848D87 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 57 | FEB419FF1D87CB7800848D87 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 58 | FEB41A021D87CB7800848D87 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 59 | FEB41A041D87CB7800848D87 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | FEB41A091D87CB7800848D87 /* ProgressViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ProgressViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 61 | FEB41A0D1D87CB7800848D87 /* ProgressViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProgressViewTests.m; sourceTree = ""; }; 62 | FEB41A0F1D87CB7800848D87 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 63 | FEB41A141D87CB7800848D87 /* ProgressViewUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ProgressViewUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 64 | FEB41A181D87CB7800848D87 /* ProgressViewUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProgressViewUITests.m; sourceTree = ""; }; 65 | FEB41A1A1D87CB7800848D87 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 66 | FEB41A281D87CE2E00848D87 /* CircleProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CircleProgressView.h; sourceTree = ""; }; 67 | FEB41A291D87CE2E00848D87 /* CircleProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CircleProgressView.m; sourceTree = ""; }; 68 | FEB41A2B1D87CE4800848D87 /* WaveProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WaveProgressView.h; sourceTree = ""; }; 69 | FEB41A2C1D87CE4800848D87 /* WaveProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WaveProgressView.m; sourceTree = ""; }; 70 | FEC312F61DBD9DF30025D96C /* HemicycleLoadProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HemicycleLoadProgressView.h; sourceTree = ""; }; 71 | FEC312F71DBD9DF30025D96C /* HemicycleLoadProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HemicycleLoadProgressView.m; sourceTree = ""; }; 72 | /* End PBXFileReference section */ 73 | 74 | /* Begin PBXFrameworksBuildPhase section */ 75 | FEB419ED1D87CB7800848D87 /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | FEB41A061D87CB7800848D87 /* Frameworks */ = { 83 | isa = PBXFrameworksBuildPhase; 84 | buildActionMask = 2147483647; 85 | files = ( 86 | ); 87 | runOnlyForDeploymentPostprocessing = 0; 88 | }; 89 | FEB41A111D87CB7800848D87 /* Frameworks */ = { 90 | isa = PBXFrameworksBuildPhase; 91 | buildActionMask = 2147483647; 92 | files = ( 93 | ); 94 | runOnlyForDeploymentPostprocessing = 0; 95 | }; 96 | /* End PBXFrameworksBuildPhase section */ 97 | 98 | /* Begin PBXGroup section */ 99 | FE5189F31D8E732C00631DDE /* LoadProgressView */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | FE5189F41D8E734100631DDE /* LoadProgressView.h */, 103 | FE5189F51D8E734100631DDE /* LoadProgressView.m */, 104 | FEC312F61DBD9DF30025D96C /* HemicycleLoadProgressView.h */, 105 | FEC312F71DBD9DF30025D96C /* HemicycleLoadProgressView.m */, 106 | 7046FA8B1E824B80004BAE09 /* AiQIYiLoadProgerssView.h */, 107 | 7046FA891E824B6E004BAE09 /* AiQIYiLoadProgerssView.m */, 108 | ); 109 | path = LoadProgressView; 110 | sourceTree = ""; 111 | }; 112 | FE5189F71D8E9FE400631DDE /* ColorProgressView */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | FE5189F81D8E9FFB00631DDE /* ColorProgressView.h */, 116 | FE5189F91D8E9FFB00631DDE /* ColorProgressView.m */, 117 | ); 118 | path = ColorProgressView; 119 | sourceTree = ""; 120 | }; 121 | FEB419E71D87CB7800848D87 = { 122 | isa = PBXGroup; 123 | children = ( 124 | FE5189F71D8E9FE400631DDE /* ColorProgressView */, 125 | FE5189F31D8E732C00631DDE /* LoadProgressView */, 126 | FEB41A261D87CD2000848D87 /* CircleProgressView */, 127 | FEB41A271D87CD2000848D87 /* WaveProgressView */, 128 | FEB419F21D87CB7800848D87 /* ProgressView */, 129 | FEB41A0C1D87CB7800848D87 /* ProgressViewTests */, 130 | FEB41A171D87CB7800848D87 /* ProgressViewUITests */, 131 | FEB419F11D87CB7800848D87 /* Products */, 132 | ); 133 | sourceTree = ""; 134 | }; 135 | FEB419F11D87CB7800848D87 /* Products */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | FEB419F01D87CB7800848D87 /* ProgressView.app */, 139 | FEB41A091D87CB7800848D87 /* ProgressViewTests.xctest */, 140 | FEB41A141D87CB7800848D87 /* ProgressViewUITests.xctest */, 141 | ); 142 | name = Products; 143 | sourceTree = ""; 144 | }; 145 | FEB419F21D87CB7800848D87 /* ProgressView */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | FEB419F61D87CB7800848D87 /* AppDelegate.h */, 149 | FEB419F71D87CB7800848D87 /* AppDelegate.m */, 150 | FEB419F91D87CB7800848D87 /* ViewController.h */, 151 | FEB419FA1D87CB7800848D87 /* ViewController.m */, 152 | FEB419FC1D87CB7800848D87 /* Main.storyboard */, 153 | FEB419FF1D87CB7800848D87 /* Assets.xcassets */, 154 | FEB41A011D87CB7800848D87 /* LaunchScreen.storyboard */, 155 | FEB41A041D87CB7800848D87 /* Info.plist */, 156 | FEB419F31D87CB7800848D87 /* Supporting Files */, 157 | ); 158 | path = ProgressView; 159 | sourceTree = ""; 160 | }; 161 | FEB419F31D87CB7800848D87 /* Supporting Files */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | FEB419F41D87CB7800848D87 /* main.m */, 165 | ); 166 | name = "Supporting Files"; 167 | sourceTree = ""; 168 | }; 169 | FEB41A0C1D87CB7800848D87 /* ProgressViewTests */ = { 170 | isa = PBXGroup; 171 | children = ( 172 | FEB41A0D1D87CB7800848D87 /* ProgressViewTests.m */, 173 | FEB41A0F1D87CB7800848D87 /* Info.plist */, 174 | ); 175 | path = ProgressViewTests; 176 | sourceTree = ""; 177 | }; 178 | FEB41A171D87CB7800848D87 /* ProgressViewUITests */ = { 179 | isa = PBXGroup; 180 | children = ( 181 | FEB41A181D87CB7800848D87 /* ProgressViewUITests.m */, 182 | FEB41A1A1D87CB7800848D87 /* Info.plist */, 183 | ); 184 | path = ProgressViewUITests; 185 | sourceTree = ""; 186 | }; 187 | FEB41A261D87CD2000848D87 /* CircleProgressView */ = { 188 | isa = PBXGroup; 189 | children = ( 190 | FEB41A281D87CE2E00848D87 /* CircleProgressView.h */, 191 | FEB41A291D87CE2E00848D87 /* CircleProgressView.m */, 192 | ); 193 | path = CircleProgressView; 194 | sourceTree = ""; 195 | }; 196 | FEB41A271D87CD2000848D87 /* WaveProgressView */ = { 197 | isa = PBXGroup; 198 | children = ( 199 | FEB41A2B1D87CE4800848D87 /* WaveProgressView.h */, 200 | FEB41A2C1D87CE4800848D87 /* WaveProgressView.m */, 201 | ); 202 | path = WaveProgressView; 203 | sourceTree = ""; 204 | }; 205 | /* End PBXGroup section */ 206 | 207 | /* Begin PBXNativeTarget section */ 208 | FEB419EF1D87CB7800848D87 /* ProgressView */ = { 209 | isa = PBXNativeTarget; 210 | buildConfigurationList = FEB41A1D1D87CB7800848D87 /* Build configuration list for PBXNativeTarget "ProgressView" */; 211 | buildPhases = ( 212 | FEB419EC1D87CB7800848D87 /* Sources */, 213 | FEB419ED1D87CB7800848D87 /* Frameworks */, 214 | FEB419EE1D87CB7800848D87 /* Resources */, 215 | ); 216 | buildRules = ( 217 | ); 218 | dependencies = ( 219 | ); 220 | name = ProgressView; 221 | productName = ProgressView; 222 | productReference = FEB419F01D87CB7800848D87 /* ProgressView.app */; 223 | productType = "com.apple.product-type.application"; 224 | }; 225 | FEB41A081D87CB7800848D87 /* ProgressViewTests */ = { 226 | isa = PBXNativeTarget; 227 | buildConfigurationList = FEB41A201D87CB7800848D87 /* Build configuration list for PBXNativeTarget "ProgressViewTests" */; 228 | buildPhases = ( 229 | FEB41A051D87CB7800848D87 /* Sources */, 230 | FEB41A061D87CB7800848D87 /* Frameworks */, 231 | FEB41A071D87CB7800848D87 /* Resources */, 232 | ); 233 | buildRules = ( 234 | ); 235 | dependencies = ( 236 | FEB41A0B1D87CB7800848D87 /* PBXTargetDependency */, 237 | ); 238 | name = ProgressViewTests; 239 | productName = ProgressViewTests; 240 | productReference = FEB41A091D87CB7800848D87 /* ProgressViewTests.xctest */; 241 | productType = "com.apple.product-type.bundle.unit-test"; 242 | }; 243 | FEB41A131D87CB7800848D87 /* ProgressViewUITests */ = { 244 | isa = PBXNativeTarget; 245 | buildConfigurationList = FEB41A231D87CB7800848D87 /* Build configuration list for PBXNativeTarget "ProgressViewUITests" */; 246 | buildPhases = ( 247 | FEB41A101D87CB7800848D87 /* Sources */, 248 | FEB41A111D87CB7800848D87 /* Frameworks */, 249 | FEB41A121D87CB7800848D87 /* Resources */, 250 | ); 251 | buildRules = ( 252 | ); 253 | dependencies = ( 254 | FEB41A161D87CB7800848D87 /* PBXTargetDependency */, 255 | ); 256 | name = ProgressViewUITests; 257 | productName = ProgressViewUITests; 258 | productReference = FEB41A141D87CB7800848D87 /* ProgressViewUITests.xctest */; 259 | productType = "com.apple.product-type.bundle.ui-testing"; 260 | }; 261 | /* End PBXNativeTarget section */ 262 | 263 | /* Begin PBXProject section */ 264 | FEB419E81D87CB7800848D87 /* Project object */ = { 265 | isa = PBXProject; 266 | attributes = { 267 | LastUpgradeCheck = 0730; 268 | ORGANIZATIONNAME = zhaoName; 269 | TargetAttributes = { 270 | FEB419EF1D87CB7800848D87 = { 271 | CreatedOnToolsVersion = 7.3.1; 272 | DevelopmentTeam = C286J3CQWQ; 273 | ProvisioningStyle = Automatic; 274 | }; 275 | FEB41A081D87CB7800848D87 = { 276 | CreatedOnToolsVersion = 7.3.1; 277 | DevelopmentTeam = 68JDS85SLB; 278 | TestTargetID = FEB419EF1D87CB7800848D87; 279 | }; 280 | FEB41A131D87CB7800848D87 = { 281 | CreatedOnToolsVersion = 7.3.1; 282 | DevelopmentTeam = 68JDS85SLB; 283 | TestTargetID = FEB419EF1D87CB7800848D87; 284 | }; 285 | }; 286 | }; 287 | buildConfigurationList = FEB419EB1D87CB7800848D87 /* Build configuration list for PBXProject "ProgressView" */; 288 | compatibilityVersion = "Xcode 3.2"; 289 | developmentRegion = English; 290 | hasScannedForEncodings = 0; 291 | knownRegions = ( 292 | en, 293 | Base, 294 | ); 295 | mainGroup = FEB419E71D87CB7800848D87; 296 | productRefGroup = FEB419F11D87CB7800848D87 /* Products */; 297 | projectDirPath = ""; 298 | projectRoot = ""; 299 | targets = ( 300 | FEB419EF1D87CB7800848D87 /* ProgressView */, 301 | FEB41A081D87CB7800848D87 /* ProgressViewTests */, 302 | FEB41A131D87CB7800848D87 /* ProgressViewUITests */, 303 | ); 304 | }; 305 | /* End PBXProject section */ 306 | 307 | /* Begin PBXResourcesBuildPhase section */ 308 | FEB419EE1D87CB7800848D87 /* Resources */ = { 309 | isa = PBXResourcesBuildPhase; 310 | buildActionMask = 2147483647; 311 | files = ( 312 | FEB41A031D87CB7800848D87 /* LaunchScreen.storyboard in Resources */, 313 | FEB41A001D87CB7800848D87 /* Assets.xcassets in Resources */, 314 | FEB419FE1D87CB7800848D87 /* Main.storyboard in Resources */, 315 | ); 316 | runOnlyForDeploymentPostprocessing = 0; 317 | }; 318 | FEB41A071D87CB7800848D87 /* Resources */ = { 319 | isa = PBXResourcesBuildPhase; 320 | buildActionMask = 2147483647; 321 | files = ( 322 | ); 323 | runOnlyForDeploymentPostprocessing = 0; 324 | }; 325 | FEB41A121D87CB7800848D87 /* Resources */ = { 326 | isa = PBXResourcesBuildPhase; 327 | buildActionMask = 2147483647; 328 | files = ( 329 | ); 330 | runOnlyForDeploymentPostprocessing = 0; 331 | }; 332 | /* End PBXResourcesBuildPhase section */ 333 | 334 | /* Begin PBXSourcesBuildPhase section */ 335 | FEB419EC1D87CB7800848D87 /* Sources */ = { 336 | isa = PBXSourcesBuildPhase; 337 | buildActionMask = 2147483647; 338 | files = ( 339 | FEB419FB1D87CB7800848D87 /* ViewController.m in Sources */, 340 | FEC312F81DBD9DF30025D96C /* HemicycleLoadProgressView.m in Sources */, 341 | FEB41A2A1D87CE2E00848D87 /* CircleProgressView.m in Sources */, 342 | FE5189FA1D8E9FFB00631DDE /* ColorProgressView.m in Sources */, 343 | 7046FA8A1E824B6E004BAE09 /* AiQIYiLoadProgerssView.m in Sources */, 344 | FEB41A2D1D87CE4800848D87 /* WaveProgressView.m in Sources */, 345 | FEB419F81D87CB7800848D87 /* AppDelegate.m in Sources */, 346 | FEB419F51D87CB7800848D87 /* main.m in Sources */, 347 | FE5189F61D8E734100631DDE /* LoadProgressView.m in Sources */, 348 | ); 349 | runOnlyForDeploymentPostprocessing = 0; 350 | }; 351 | FEB41A051D87CB7800848D87 /* Sources */ = { 352 | isa = PBXSourcesBuildPhase; 353 | buildActionMask = 2147483647; 354 | files = ( 355 | FEB41A0E1D87CB7800848D87 /* ProgressViewTests.m in Sources */, 356 | ); 357 | runOnlyForDeploymentPostprocessing = 0; 358 | }; 359 | FEB41A101D87CB7800848D87 /* Sources */ = { 360 | isa = PBXSourcesBuildPhase; 361 | buildActionMask = 2147483647; 362 | files = ( 363 | FEB41A191D87CB7800848D87 /* ProgressViewUITests.m in Sources */, 364 | ); 365 | runOnlyForDeploymentPostprocessing = 0; 366 | }; 367 | /* End PBXSourcesBuildPhase section */ 368 | 369 | /* Begin PBXTargetDependency section */ 370 | FEB41A0B1D87CB7800848D87 /* PBXTargetDependency */ = { 371 | isa = PBXTargetDependency; 372 | target = FEB419EF1D87CB7800848D87 /* ProgressView */; 373 | targetProxy = FEB41A0A1D87CB7800848D87 /* PBXContainerItemProxy */; 374 | }; 375 | FEB41A161D87CB7800848D87 /* PBXTargetDependency */ = { 376 | isa = PBXTargetDependency; 377 | target = FEB419EF1D87CB7800848D87 /* ProgressView */; 378 | targetProxy = FEB41A151D87CB7800848D87 /* PBXContainerItemProxy */; 379 | }; 380 | /* End PBXTargetDependency section */ 381 | 382 | /* Begin PBXVariantGroup section */ 383 | FEB419FC1D87CB7800848D87 /* Main.storyboard */ = { 384 | isa = PBXVariantGroup; 385 | children = ( 386 | FEB419FD1D87CB7800848D87 /* Base */, 387 | ); 388 | name = Main.storyboard; 389 | sourceTree = ""; 390 | }; 391 | FEB41A011D87CB7800848D87 /* LaunchScreen.storyboard */ = { 392 | isa = PBXVariantGroup; 393 | children = ( 394 | FEB41A021D87CB7800848D87 /* Base */, 395 | ); 396 | name = LaunchScreen.storyboard; 397 | sourceTree = ""; 398 | }; 399 | /* End PBXVariantGroup section */ 400 | 401 | /* Begin XCBuildConfiguration section */ 402 | FEB41A1B1D87CB7800848D87 /* Debug */ = { 403 | isa = XCBuildConfiguration; 404 | buildSettings = { 405 | ALWAYS_SEARCH_USER_PATHS = NO; 406 | CLANG_ANALYZER_NONNULL = YES; 407 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 408 | CLANG_CXX_LIBRARY = "libc++"; 409 | CLANG_ENABLE_MODULES = YES; 410 | CLANG_ENABLE_OBJC_ARC = YES; 411 | CLANG_WARN_BOOL_CONVERSION = YES; 412 | CLANG_WARN_CONSTANT_CONVERSION = YES; 413 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 414 | CLANG_WARN_EMPTY_BODY = YES; 415 | CLANG_WARN_ENUM_CONVERSION = YES; 416 | CLANG_WARN_INT_CONVERSION = YES; 417 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 418 | CLANG_WARN_UNREACHABLE_CODE = YES; 419 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 420 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 421 | COPY_PHASE_STRIP = NO; 422 | DEBUG_INFORMATION_FORMAT = dwarf; 423 | ENABLE_STRICT_OBJC_MSGSEND = YES; 424 | ENABLE_TESTABILITY = YES; 425 | GCC_C_LANGUAGE_STANDARD = gnu99; 426 | GCC_DYNAMIC_NO_PIC = NO; 427 | GCC_NO_COMMON_BLOCKS = YES; 428 | GCC_OPTIMIZATION_LEVEL = 0; 429 | GCC_PREPROCESSOR_DEFINITIONS = ( 430 | "DEBUG=1", 431 | "$(inherited)", 432 | ); 433 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 434 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 435 | GCC_WARN_UNDECLARED_SELECTOR = YES; 436 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 437 | GCC_WARN_UNUSED_FUNCTION = YES; 438 | GCC_WARN_UNUSED_VARIABLE = YES; 439 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 440 | MTL_ENABLE_DEBUG_INFO = YES; 441 | ONLY_ACTIVE_ARCH = YES; 442 | SDKROOT = iphoneos; 443 | }; 444 | name = Debug; 445 | }; 446 | FEB41A1C1D87CB7800848D87 /* Release */ = { 447 | isa = XCBuildConfiguration; 448 | buildSettings = { 449 | ALWAYS_SEARCH_USER_PATHS = NO; 450 | CLANG_ANALYZER_NONNULL = YES; 451 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 452 | CLANG_CXX_LIBRARY = "libc++"; 453 | CLANG_ENABLE_MODULES = YES; 454 | CLANG_ENABLE_OBJC_ARC = YES; 455 | CLANG_WARN_BOOL_CONVERSION = YES; 456 | CLANG_WARN_CONSTANT_CONVERSION = YES; 457 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 458 | CLANG_WARN_EMPTY_BODY = YES; 459 | CLANG_WARN_ENUM_CONVERSION = YES; 460 | CLANG_WARN_INT_CONVERSION = YES; 461 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 462 | CLANG_WARN_UNREACHABLE_CODE = YES; 463 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 464 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 465 | COPY_PHASE_STRIP = NO; 466 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 467 | ENABLE_NS_ASSERTIONS = NO; 468 | ENABLE_STRICT_OBJC_MSGSEND = YES; 469 | GCC_C_LANGUAGE_STANDARD = gnu99; 470 | GCC_NO_COMMON_BLOCKS = YES; 471 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 472 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 473 | GCC_WARN_UNDECLARED_SELECTOR = YES; 474 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 475 | GCC_WARN_UNUSED_FUNCTION = YES; 476 | GCC_WARN_UNUSED_VARIABLE = YES; 477 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 478 | MTL_ENABLE_DEBUG_INFO = NO; 479 | SDKROOT = iphoneos; 480 | VALIDATE_PRODUCT = YES; 481 | }; 482 | name = Release; 483 | }; 484 | FEB41A1E1D87CB7800848D87 /* Debug */ = { 485 | isa = XCBuildConfiguration; 486 | buildSettings = { 487 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 488 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 489 | DEVELOPMENT_TEAM = C286J3CQWQ; 490 | INFOPLIST_FILE = ProgressView/Info.plist; 491 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 492 | PRODUCT_BUNDLE_IDENTIFIER = zhaoName.ProgressView; 493 | PRODUCT_NAME = "$(TARGET_NAME)"; 494 | PROVISIONING_PROFILE = ""; 495 | }; 496 | name = Debug; 497 | }; 498 | FEB41A1F1D87CB7800848D87 /* Release */ = { 499 | isa = XCBuildConfiguration; 500 | buildSettings = { 501 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 502 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 503 | DEVELOPMENT_TEAM = C286J3CQWQ; 504 | INFOPLIST_FILE = ProgressView/Info.plist; 505 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 506 | PRODUCT_BUNDLE_IDENTIFIER = zhaoName.ProgressView; 507 | PRODUCT_NAME = "$(TARGET_NAME)"; 508 | PROVISIONING_PROFILE = ""; 509 | }; 510 | name = Release; 511 | }; 512 | FEB41A211D87CB7800848D87 /* Debug */ = { 513 | isa = XCBuildConfiguration; 514 | buildSettings = { 515 | BUNDLE_LOADER = "$(TEST_HOST)"; 516 | INFOPLIST_FILE = ProgressViewTests/Info.plist; 517 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 518 | PRODUCT_BUNDLE_IDENTIFIER = zhaoName.ProgressViewTests; 519 | PRODUCT_NAME = "$(TARGET_NAME)"; 520 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ProgressView.app/ProgressView"; 521 | }; 522 | name = Debug; 523 | }; 524 | FEB41A221D87CB7800848D87 /* Release */ = { 525 | isa = XCBuildConfiguration; 526 | buildSettings = { 527 | BUNDLE_LOADER = "$(TEST_HOST)"; 528 | INFOPLIST_FILE = ProgressViewTests/Info.plist; 529 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 530 | PRODUCT_BUNDLE_IDENTIFIER = zhaoName.ProgressViewTests; 531 | PRODUCT_NAME = "$(TARGET_NAME)"; 532 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ProgressView.app/ProgressView"; 533 | }; 534 | name = Release; 535 | }; 536 | FEB41A241D87CB7800848D87 /* Debug */ = { 537 | isa = XCBuildConfiguration; 538 | buildSettings = { 539 | INFOPLIST_FILE = ProgressViewUITests/Info.plist; 540 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 541 | PRODUCT_BUNDLE_IDENTIFIER = zhaoName.ProgressViewUITests; 542 | PRODUCT_NAME = "$(TARGET_NAME)"; 543 | TEST_TARGET_NAME = ProgressView; 544 | }; 545 | name = Debug; 546 | }; 547 | FEB41A251D87CB7800848D87 /* Release */ = { 548 | isa = XCBuildConfiguration; 549 | buildSettings = { 550 | INFOPLIST_FILE = ProgressViewUITests/Info.plist; 551 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 552 | PRODUCT_BUNDLE_IDENTIFIER = zhaoName.ProgressViewUITests; 553 | PRODUCT_NAME = "$(TARGET_NAME)"; 554 | TEST_TARGET_NAME = ProgressView; 555 | }; 556 | name = Release; 557 | }; 558 | /* End XCBuildConfiguration section */ 559 | 560 | /* Begin XCConfigurationList section */ 561 | FEB419EB1D87CB7800848D87 /* Build configuration list for PBXProject "ProgressView" */ = { 562 | isa = XCConfigurationList; 563 | buildConfigurations = ( 564 | FEB41A1B1D87CB7800848D87 /* Debug */, 565 | FEB41A1C1D87CB7800848D87 /* Release */, 566 | ); 567 | defaultConfigurationIsVisible = 0; 568 | defaultConfigurationName = Release; 569 | }; 570 | FEB41A1D1D87CB7800848D87 /* Build configuration list for PBXNativeTarget "ProgressView" */ = { 571 | isa = XCConfigurationList; 572 | buildConfigurations = ( 573 | FEB41A1E1D87CB7800848D87 /* Debug */, 574 | FEB41A1F1D87CB7800848D87 /* Release */, 575 | ); 576 | defaultConfigurationIsVisible = 0; 577 | defaultConfigurationName = Release; 578 | }; 579 | FEB41A201D87CB7800848D87 /* Build configuration list for PBXNativeTarget "ProgressViewTests" */ = { 580 | isa = XCConfigurationList; 581 | buildConfigurations = ( 582 | FEB41A211D87CB7800848D87 /* Debug */, 583 | FEB41A221D87CB7800848D87 /* Release */, 584 | ); 585 | defaultConfigurationIsVisible = 0; 586 | defaultConfigurationName = Release; 587 | }; 588 | FEB41A231D87CB7800848D87 /* Build configuration list for PBXNativeTarget "ProgressViewUITests" */ = { 589 | isa = XCConfigurationList; 590 | buildConfigurations = ( 591 | FEB41A241D87CB7800848D87 /* Debug */, 592 | FEB41A251D87CB7800848D87 /* Release */, 593 | ); 594 | defaultConfigurationIsVisible = 0; 595 | defaultConfigurationName = Release; 596 | }; 597 | /* End XCConfigurationList section */ 598 | }; 599 | rootObject = FEB419E81D87CB7800848D87 /* Project object */; 600 | } 601 | -------------------------------------------------------------------------------- /ProgressView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ProgressView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ProgressView.xcodeproj/project.xcworkspace/xcuserdata/zhao.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaoName/ProgressView/4135534abf88b865bc18bfb2cae0021cffe0d45f/ProgressView.xcodeproj/project.xcworkspace/xcuserdata/zhao.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ProgressView.xcodeproj/xcuserdata/zhao.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /ProgressView.xcodeproj/xcuserdata/zhao.xcuserdatad/xcschemes/ProgressView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /ProgressView.xcodeproj/xcuserdata/zhao.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ProgressView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | FEB419EF1D87CB7800848D87 16 | 17 | primary 18 | 19 | 20 | FEB41A081D87CB7800848D87 21 | 22 | primary 23 | 24 | 25 | FEB41A131D87CB7800848D87 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /ProgressView.xcodeproj/xcuserdata/zhaosongbo.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /ProgressView.xcodeproj/xcuserdata/zhaosongbo.xcuserdatad/xcschemes/ProgressView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /ProgressView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ProgressView 4 | // 5 | // Created by zhao on 16/9/13. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /ProgressView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ProgressView 4 | // 5 | // Created by zhao on 16/9/13. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /ProgressView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /ProgressView/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ProgressView/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ProgressView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ProgressView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ProgressView 4 | // 5 | // Created by zhao on 16/9/13. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /ProgressView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ProgressView 4 | // 5 | // Created by zhao on 16/9/13. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "CircleProgressView.h" 11 | #import "WaveProgressView.h" 12 | #import "LoadProgressView.h" 13 | #import "ColorProgressView.h" 14 | #import "HemicycleLoadProgressView.h" 15 | #import "AiQIYiLoadProgerssView.h" 16 | 17 | @interface ViewController () 18 | 19 | @property (nonatomic, strong) CircleProgressView *circleProgress; 20 | @property (nonatomic, strong) CircleProgressView *anticlockwiseProgress; 21 | 22 | @property (nonatomic, strong) NSTimer *timer; 23 | @property (nonatomic, strong) WaveProgressView *noWaveProgress; 24 | @property (nonatomic, strong) WaveProgressView *waveProgress; 25 | 26 | @property (nonatomic, strong) LoadProgressView *loadProgress; 27 | @property (nonatomic, strong) HemicycleLoadProgressView *cycleLoadProgress; 28 | @property (nonatomic, strong) AiQIYiLoadProgerssView *aiqiyiProgress; /**< 彷爱奇艺*/ 29 | 30 | @property (nonatomic, strong) ColorProgressView *colorProgress; 31 | 32 | @end 33 | 34 | @implementation ViewController 35 | 36 | - (void)viewDidLoad { 37 | [super viewDidLoad]; 38 | 39 | [self.view addSubview:self.circleProgress]; 40 | self.anticlockwiseProgress.delegate = self; 41 | self.anticlockwiseProgress.centerLabel.text = @"跳过"; 42 | [self.view addSubview:self.anticlockwiseProgress]; 43 | 44 | [self.view addSubview:self.noWaveProgress]; 45 | [self.view addSubview:self.waveProgress]; 46 | 47 | [self.view addSubview:self.loadProgress]; 48 | [self.loadProgress addNotificationObserver]; 49 | 50 | [self.view addSubview:self.colorProgress]; 51 | [self createColorButton]; 52 | 53 | [self.view addSubview:self.cycleLoadProgress]; 54 | [self.cycleLoadProgress addNotificationObserver]; 55 | 56 | [self.view addSubview:self.aiqiyiProgress]; 57 | [self.aiqiyiProgress addNotificationObserver]; 58 | 59 | self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(progressTimer:) userInfo:nil repeats:YES]; 60 | } 61 | 62 | - (void)progressTimer:(NSTimer *)timer 63 | { 64 | self.circleProgress.percent += 0.05; 65 | self.circleProgress.centerLabel.text = [NSString stringWithFormat:@"%.02f%%", self.circleProgress.percent*100]; 66 | 67 | self.anticlockwiseProgress.percent += 0.05; 68 | 69 | self.noWaveProgress.percent += 0.05; 70 | self.noWaveProgress.centerLabel.text = [NSString stringWithFormat:@"%.02f%%", self.noWaveProgress.percent*100]; 71 | 72 | self.waveProgress.percent += 0.05; 73 | self.waveProgress.centerLabel.text = [NSString stringWithFormat:@"%.02f%%", self.waveProgress.percent*100]; 74 | 75 | if(self.waveProgress.percent > 1) 76 | { 77 | [self.timer invalidate]; 78 | } 79 | } 80 | 81 | #pragma mark -- CircleProgressViewDelegate 82 | - (void)theCallbackOfClickCenterLabel 83 | { 84 | NSLog(@"点击了中间按钮"); 85 | } 86 | 87 | #pragma mark -- 颜色进度条 88 | 89 | /** 90 | * 创建颜色按钮 这个控件最好不要放在ColorProgressView封装 设置btn的center在圆上btn会被切掉一半,不好控制frame 91 | */ 92 | - (void)createColorButton 93 | { 94 | UIButton *colorBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 95 | colorBtn.frame = CGRectMake(0, 0, 20, 20); 96 | colorBtn.center = CGPointMake(250, 323); 97 | colorBtn.layer.cornerRadius = CGRectGetWidth(colorBtn.frame)/2; 98 | colorBtn.backgroundColor = [self.colorProgress colorWithCirclePoint:CGPointMake(250-200, 323-320)];; 99 | [colorBtn addTarget:self action:@selector(touchColorBtn: event:) forControlEvents:UIControlEventTouchDragInside]; 100 | [self.view addSubview:colorBtn]; 101 | } 102 | 103 | - (void)touchColorBtn:(UIButton *)colorBtn event:(UIEvent *)event 104 | { 105 | UITouch *touch = [[event allTouches] anyObject]; 106 | CGPoint btnPoint = [touch locationInView:self.view]; 107 | //随着拖拽按钮改变按钮的位置 108 | colorBtn.center = [self.colorProgress getColorBtnCenterWithDragBtnPoint:btnPoint centerOfCircle:self.colorProgress.center]; 109 | CGPoint center = colorBtn.center; 110 | //注意 你获取的是self.colorProgress上的颜色,所以你的坐标应该是self.colorProgress为父视图的坐标 111 | center.x -= CGRectGetMinX(self.colorProgress.frame); 112 | center.y -= CGRectGetMinY(self.colorProgress.frame); 113 | colorBtn.backgroundColor = [self.colorProgress colorWithCirclePoint:center]; 114 | } 115 | 116 | #pragma mark -- getter 117 | 118 | - (CircleProgressView *)circleProgress 119 | { 120 | if(!_circleProgress) 121 | { 122 | _circleProgress = [[CircleProgressView alloc] initWithFrame:CGRectMake(50, 80, 80, 80)]; 123 | _circleProgress.backgroundColor = [UIColor clearColor]; 124 | } 125 | return _circleProgress; 126 | } 127 | 128 | - (CircleProgressView *)anticlockwiseProgress 129 | { 130 | if(!_anticlockwiseProgress) 131 | { 132 | _anticlockwiseProgress = [[CircleProgressView alloc] initWithFrame:CGRectMake(200, 80, 80, 80)]; 133 | _anticlockwiseProgress.clockwise = YES; 134 | _anticlockwiseProgress.backgroundColor = [UIColor clearColor]; 135 | } 136 | return _anticlockwiseProgress; 137 | } 138 | 139 | - (WaveProgressView *)noWaveProgress 140 | { 141 | if(!_noWaveProgress) 142 | { 143 | _noWaveProgress = [[WaveProgressView alloc] initWithFrame:CGRectMake(50, 200, 80, 80)]; 144 | _noWaveProgress.isShowWave = NO; 145 | } 146 | return _noWaveProgress; 147 | } 148 | 149 | - (WaveProgressView *)waveProgress 150 | { 151 | if(!_waveProgress) 152 | { 153 | _waveProgress = [[WaveProgressView alloc] initWithFrame:CGRectMake(200, 200, 80, 80)]; 154 | } 155 | return _waveProgress; 156 | } 157 | 158 | - (LoadProgressView *)loadProgress 159 | { 160 | if(!_loadProgress) 161 | { 162 | _loadProgress = [[LoadProgressView alloc] initWithFrame:CGRectMake(50, 320, 50, 50)]; 163 | _loadProgress.progressColors = @[[UIColor redColor], [UIColor blueColor], [UIColor orangeColor], [UIColor greenColor]]; 164 | } 165 | return _loadProgress; 166 | } 167 | 168 | - (HemicycleLoadProgressView *)cycleLoadProgress 169 | { 170 | if(!_cycleLoadProgress) 171 | { 172 | _cycleLoadProgress = [[HemicycleLoadProgressView alloc] initWithFrame:CGRectMake(50, 400, 50, 50)]; 173 | } 174 | return _cycleLoadProgress; 175 | } 176 | 177 | - (AiQIYiLoadProgerssView *)aiqiyiProgress 178 | { 179 | if(!_aiqiyiProgress) 180 | { 181 | _aiqiyiProgress = [[AiQIYiLoadProgerssView alloc] initWithFrame:CGRectMake(50, 480, 50, 50)]; 182 | } 183 | return _aiqiyiProgress; 184 | } 185 | 186 | - (ColorProgressView *)colorProgress 187 | { 188 | if(!_colorProgress) 189 | { 190 | _colorProgress = [[ColorProgressView alloc] initWithFrame:CGRectMake(200, 320, 100, 100)]; 191 | } 192 | return _colorProgress; 193 | } 194 | 195 | @end 196 | -------------------------------------------------------------------------------- /ProgressView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ProgressView 4 | // 5 | // Created by zhao on 16/9/13. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ProgressViewTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ProgressViewTests/ProgressViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressViewTests.m 3 | // ProgressViewTests 4 | // 5 | // Created by zhao on 16/9/13. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ProgressViewTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ProgressViewTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /ProgressViewUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ProgressViewUITests/ProgressViewUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressViewUITests.m 3 | // ProgressViewUITests 4 | // 5 | // Created by zhao on 16/9/13. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ProgressViewUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ProgressViewUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ProgressView 2 | 进度条 3 | 4 | 个人感觉里面的注释已经很详细了,在这里就不多说了。需要用到那个进度条,把对应的文件夹拖入到工程中就可以了 5 | 6 | ![image](https://github.com/zhaoName/ProgressView/blob/master/ProgressView.gif) 7 | -------------------------------------------------------------------------------- /WaveProgressView/WaveProgressView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WaveProgressView.h 3 | // ProgressView 4 | // 5 | // Created by zhao on 16/9/13. 6 | // Copyright © 2016年 zhaoName. All rights reserved. 7 | // 波浪式的进度条 8 | 9 | #import 10 | 11 | @interface WaveProgressView : UIView 12 | 13 | @property (nonatomic, strong) UIColor *progressBackgroundColor; /**< 进度条背景色*/ 14 | @property (nonatomic, assign) CGFloat progressWidth; /**< 进度条宽度 默认3*/ 15 | @property (nonatomic, assign) float percent; /**< 进度条进度 0-1*/ 16 | 17 | @property (nonatomic, strong) UILabel *centerLabel; /**< 记录进度的Label*/ 18 | @property (nonatomic, strong) UIColor *labelbackgroundColor; /** 1){// >1则不需要波纹 131 | CGPathAddLineToPoint(path, nil, WIDTH, y); 132 | break; 133 | } 134 | // 正弦波浪公式 坐标转换将x装换为对应的弧度值:(self.waveCycle * x / WIDTH) * M_PI*2; 平移:self.offsetX 135 | y = self.waveAmplitude * sin((self.waveCycle * x / WIDTH) * M_PI*2 + self.offsetX) + y; 136 | CGPathAddLineToPoint(path, nil, x, y); 137 | // 每次重置y值 不要累加 138 | y = HEIGHT - self.progressWidth - self.percent * (HEIGHT - self.progressWidth*2); 139 | } 140 | 141 | CGPathAddLineToPoint(path, nil, WIDTH, HEIGHT - self.progressWidth); 142 | CGPathAddLineToPoint(path, nil, 0, HEIGHT - self.progressWidth); 143 | CGPathCloseSubpath(path); 144 | 145 | self.firstShapeLayer.path = path; 146 | CGPathRelease(path); 147 | 148 | // 第二条波纹 149 | CGMutablePathRef secondPath = CGPathCreateMutable(); 150 | CGPathMoveToPoint(secondPath, nil, 0, y); 151 | for (float x = 0.0f; x <= WIDTH ; x++) 152 | { 153 | if(self.percent > 1){// >1则不需要波纹 154 | CGPathAddLineToPoint(secondPath, nil, WIDTH, y); 155 | break; 156 | } 157 | // 余弦波浪公式 158 | y = self.waveAmplitude * cos((self.waveCycle * x / WIDTH) * M_PI*2 + self.offsetX) + y; 159 | CGPathAddLineToPoint(secondPath, nil, x, y); 160 | // 每次重置y值 不要累加 161 | y = HEIGHT - self.progressWidth - self.percent * (HEIGHT - self.progressWidth*2); 162 | } 163 | 164 | CGPathAddLineToPoint(secondPath, nil, WIDTH, HEIGHT - self.progressWidth); 165 | CGPathAddLineToPoint(secondPath, nil, 0, HEIGHT - self.progressWidth); 166 | CGPathCloseSubpath(secondPath); 167 | 168 | self.secondShapeLayer.path = secondPath; 169 | CGPathRelease(secondPath); 170 | } 171 | 172 | /** 173 | * 不需要显示波纹的进度条 174 | */ 175 | - (void)showNoWaveProgress 176 | { 177 | // 第一条波纹 178 | CGMutablePathRef path = CGPathCreateMutable(); 179 | CGFloat y = HEIGHT - self.percent * (HEIGHT - self.progressWidth*2) - self.progressWidth;; 180 | CGPathMoveToPoint(path, nil, 0, y); 181 | CGPathAddLineToPoint(path, nil, WIDTH, y); 182 | CGPathAddLineToPoint(path, nil, WIDTH, HEIGHT - self.progressWidth); 183 | CGPathAddLineToPoint(path, nil, 0, HEIGHT - self.progressWidth); 184 | CGPathCloseSubpath(path); 185 | 186 | self.firstShapeLayer.path = path; 187 | CGPathRelease(path); 188 | } 189 | 190 | /** 结束动画*/ 191 | - (void)endWaveAnimation 192 | { 193 | [self.displayLink invalidate]; 194 | self.displayLink = nil; 195 | } 196 | 197 | 198 | - (void)dealloc{ 199 | [self endWaveAnimation]; 200 | } 201 | 202 | #pragma mark -- getter 203 | 204 | - (CAShapeLayer *)firstShapeLayer 205 | { 206 | if(!_firstShapeLayer) 207 | { 208 | _firstShapeLayer = [CAShapeLayer layer]; 209 | _firstShapeLayer.frame = self.bounds; 210 | _firstShapeLayer.fillColor = self.firstWaveColor.CGColor; 211 | } 212 | return _firstShapeLayer; 213 | } 214 | 215 | - (CAShapeLayer *)secondShapeLayer 216 | { 217 | if(!_secondShapeLayer) 218 | { 219 | _secondShapeLayer = [CAShapeLayer layer]; 220 | _secondShapeLayer.frame = self.bounds; 221 | _secondShapeLayer.fillColor = self.secondWaveColor.CGColor; 222 | } 223 | return _secondShapeLayer; 224 | } 225 | 226 | - (UILabel *)centerLabel 227 | { 228 | if(!_centerLabel) 229 | { 230 | _centerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, WIDTH, (HEIGHT-self.progressWidth)/2)]; 231 | _centerLabel.center = CGPointMake(WIDTH/2, (HEIGHT-self.progressWidth)/2); 232 | _centerLabel.textAlignment = NSTextAlignmentCenter; 233 | } 234 | return _centerLabel; 235 | } 236 | 237 | @end 238 | --------------------------------------------------------------------------------