iOS空心圆下载进度指示器控件

self.layer = [CAShapeLayer layer];
self.layer.frame = CGRectMake(, , , );
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(, , , )];
self.layer.path = path.CGPath;
[self.view.layer addSublayer:self.layer]; self.layer.strokeEnd = 0.0;
_progress = ;
self.timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(updateProgress) userInfo:nil repeats:YES]; //更新下载进度
_progress += 0.01; if (self.layer.strokeEnd >= ) {
self.timer.fireDate = [NSDate distantFuture];
}
else
{
self.layer.strokeEnd = _progress;
}
上一篇:ASP.NET AJAX入门系列(6):UpdateProgress控件简单介绍


下一篇:PHP 文件下载 显示进度条