I am using CAKeyframeAnimation to perform few animations in my app. I would like to play an audio file (sometimes during and sometimes after) along with the animations. How can I achieve this? Is there a AnimationDidStopSelector for CAKeyframeAnimation or is there another approach for doing this?
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;
Actually there is. First assign yourself as delegate:
If you want to use different animations you can use KVC to differentiate between them:
Then implement this method