可能重复:
Objective-C - CABasicAnimation applying changes after animation?
使用以下代码,我将动画绘制圆圈:
CAShapeLayer circle = [CAShapeLayer layer];
circle.strokeEnd = 0;
...
[self.view.layer addSublayer:circle];
CABasicAnimation *drawAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
drawAnimation.beginTime = CACurrentMediaTime() + 3;
drawAnimation.duration = 1.0;
drawAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
drawAnimation.toValue = [NSNumber numberWithFloat:1.0f];
drawAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
drawAnimation.removedOnCompletion = NO;
drawAnimation.fillMode = kCAFillModeForwards;
[circle addAnimation:drawAnimation forKey:@"drawShape"];
虽然这很好,但似乎circle.strokeEnd
实际上并未更新为1.我该怎么做?