iOS空心圆下载进度指示器控件
Posted 慢慢儿
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iOS空心圆下载进度指示器控件相关的知识,希望对你有一定的参考价值。
self.layer = [CAShapeLayer layer]; self.layer.frame = CGRectMake(0, 0, 100, 100); self.layer.position = self.view.center; self.layer.lineWidth = 10.0; self.layer.fillColor = [UIColor clearColor].CGColor; self.layer.strokeColor = [UIColor lightGrayColor].CGColor; self.layer.lineCap = kCALineCapSquare; /* CA_EXTERN NSString *const kCALineCapButt __OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_3_0); CA_EXTERN NSString *const kCALineCapRound __OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_3_0); CA_EXTERN NSString *const kCALineCapSquare */ UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, 100, 100)]; self.layer.path = path.CGPath; [self.view.layer addSublayer:self.layer]; self.layer.strokeEnd = 0.0; _progress = 0; self.timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(updateProgress) userInfo:nil repeats:YES]; //更新下载进度 _progress += 0.01; if (self.layer.strokeEnd >= 1) { self.timer.fireDate = [NSDate distantFuture]; } else { self.layer.strokeEnd = _progress; }
以上是关于iOS空心圆下载进度指示器控件的主要内容,如果未能解决你的问题,请参考以下文章