#####下载进度条 #####1.下载进度条,经常在下载方面见到
- 1.和饼状态差不多,只不过只要注意结束角度的变化
#####2.实现也较为简单,代码
-(void) setEndValue:(CGFloat)endValue{
_endValue=endValue;
NSLog(@"%f",_endValue);
//重绘,系统会先创建与view相关联的上下文,然后再调用drawRect
[self setNeedsDisplay];
}
//注意:drawRect不能手动调用,因为图形上下文我们自己创建不了,只能由系统帮我们创建,并且传递给我们
- (void)drawRect:(CGRect)rect {
//NSLog(@"sss");
UIBezierPath *path=[UIBezierPath bezierPathWithArcCenter:CGPointMake(rect.size.width*0.5, rect.size.height*0.5) radius:rect.size.height*0.5-2 startAngle:-M_PI_2 endAngle:-M_PI_2+ M_PI*2*self.endValue clockwise:YES];
[path stroke];
}
#####3.详细代码地址