查看下面的代码。这是一个简单的动画,但是当我设置beginTime = AVCoreAnimationBeginTimeAtZero
时,该动画无法正常工作,否则就可以了。
CABasicAnimation *animation = [CABasicAnimation
animationWithKeyPath:@"opacity"];
animation.duration = 2.f;
// animation.beginTime = AVCoreAnimationBeginTimeAtZero;
animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards;
animation.fromValue = [NSNumber numberWithFloat:1.0];
animation.toValue = [NSNumber numberWithFloat:0];
animation.delegate = self;
[layer addAnimation:animation forKey:@"basicAnimation"];