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;
}
04-26 21:43