How to get the end event of CATransition/Animation?
My codes show below:
CATransition *transition = [CATransition animation];
transition.duration = duration
I hope to get the end event of CATransition/Animation. Is it possi开发者_JS百科ble?
CAAnimation (which CATransition is a subclass of) has the delegate method animationDidStop:finished:
which you can use.
Set the delegate property and implement the method:
CATransition *transition = [CATransition animation];
transition.duration = duration;
transition.delegate = self;
//other settings...
//call addAnimation...
...
- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag
{
//do what you need to do when animation ends...
}
精彩评论