我正在使用 CAKeyframeAnimation 在我的应用程序中执行一些动画。我想与动画一起播放音频文件(有时在期间,有时在之后)。我怎样才能做到这一点?是否有 CAKeyframeAnimation 的 AnimationDidStopSelector 或者有其他方法可以做到这一点?
UIBezierPath *movePath = [UIBezierPath bezierPath];
[movePath moveToPoint:imageAnimation.center];
[movePath addQuadCurveToPoint:CGPointMake(839, 339)
controlPoint:CGPointMake(671, 316)];
CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
moveAnim.path = movePath.CGPath;
CAAnimationGroup *animGroup = [CAAnimationGroup animation];
animGroup.animations = [NSArray arrayWithObjects:moveAnim, nil];
animGroup.duration = 0.5;
imageAnimation.layer.position = CGPointMake(839, 339);
imageAnimation.tag = 0;
[imageAnimation.layer addAnimation:animGroup forKey:nil];
break;