【发布时间】:2018-08-03 11:08:29
【问题描述】:
我使用以下方法绘制了一条弧:
- (void)drawRect:(CGRect)rect {
UIBezierPath *stripePath = [UIBezierPath bezierPath];
[arcColor set];
[stripePath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:clockwise];
stripePath.lineWidth = arcWidth;
stripePath.lineCapStyle = kCGLineCapRound;
stripePath.lineJoinStyle = kCGLineCapRound;
[stripePath stroke];
}
现在我想通过角度为这个弧设置动画。
我正在尝试类似的东西:
angle = startAngle;
[UIView animateWithDuration:1
delay:0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
angle = endAngle;
[stripePath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:angle clockwise:clockwise];
[stripePath stroke];
}];
但是屏幕上没有显示动画。如何以角度为变化变量为弧设置动画?谢谢。
【问题讨论】:
标签: ios core-animation