如何获得CATransition / Animation的结束事件? [英] How to get the end event of CATransition/Animation?
本文介绍了如何获得CATransition / Animation的结束事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码如下所示:
CATransition *transition = [CATransition animation];
transition.duration = duration
我希望得到CATransition / Animation的结束事件。是否可能?
I hope to get the end event of CATransition/Animation. Is it possible?
推荐答案
CAAnimation(CATransition是其子类)具有委托方法 animationDidStop:完成:
您可以使用。
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...
}
这篇关于如何获得CATransition / Animation的结束事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文