开发者

How to get the end event of CATransition/Animation?

开发者 https://www.devze.com 2023-02-08 00:22 出处:网络
My codes show below: CATransition *transition = [CATransition animation]; transition.duration = duration

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...
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号