UIBezierpath绘制加载圆

时间:2015-12-11 06:49:45

标签: ios objective-c core-animation uibezierpath uianimation

我需要在iOS中使用UIBezierPath绘制如下图所示的加载图形。谁能告诉我怎么做?

我需要像“svprogresshud”

这样的装载机图形

enter image description here

1 个答案:

答案 0 :(得分:0)

试试这个你会有所了解。

UIBezierPath *bezierPath = [UIBezierPath bezierPath];
[bezierPath addArcWithCenter:center radius:50 startAngle:0 endAngle:2 * M_PI clockwise:YES];
CAShapeLayer *progressLayer = [[CAShapeLayer alloc] init];

[progressLayer setPath:bezierPath.CGPath];
[progressLayer setStrokeColor:[UIColor colorWithWhite:1.0 alpha:0.2].CGColor];
[progressLayer setFillColor:[UIColor clearColor].CGColor];
[progressLayer setLineWidth:0.3 * self.bounds.size.width];
[progressLayer setStrokeEnd:volume/100];
[_circleView.layer addSublayer:progressLayer];