I’m using following lines of code to animate:
CATransition *animation = [self getAnimation:dirString];
[[self view] exchangeSubviewAtIndex:0 withSubviewAtIndex:1];
[[[self view] layer] addAnimation:animation forKey:kAnimationKey];
After end of animation, I want to play sound.
How can I get notification when animation is completed?
CATransition is a subclass of CAAnimation, so it inherits (among other things) a
delegateproperty, and a delegate method calledanimationDidStop:finished:. Define that method in whatever class you’d like to handle the event, and set thedelegateproperty of the animation to an object of that class. When the animation finishes, theanimationDidStop:finished:message is sent to the delegate.For example: