开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜