How to get the final CATransition / Animation event?

My codes are shown below:

CATransition *transition = [CATransition animation]; transition.duration = duration 

I hope to get the final CATransition / Animation event. Is it possible?

+7
source share
1 answer

CAAnimation (in which CATransition is a subclass) has a delegate method animationDidStop:finished: that 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... } 
+24
source

All Articles