//每次改变成员属性progress的值,就会调用它的setter
- (void)setProgress:(CGFloat)progress
{
_progress = progress;
//当下载进度改变时,手动调用重绘方法
[self setNeedsDisplay];
}
- (void)drawRect:(CGRect)rect
{
//设置圆弧的半径
CGFloat radius = rect.size.width * 0.5;
//设置圆弧的圆心
CGPoint center = CGPointMake(radius, radius);
//设置圆弧的开始的角度(弧度制)
CGFloat startAngle = - M_PI_2;
//设置圆弧的终止角度
CGFloat endAngle = - M_PI_2 + 2 * M_PI * self.progress;
//使用UIBezierPath类绘制圆弧
UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:center radius:radius - 5 startAngle:startAngle endAngle:endAngle clockwise:YES];
//将绘制的圆弧渲染到图层上(即显示出来)
[path stroke];
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有