iphone - 如何获取CATransition/Animation的结束事件?

标签 iphone

我的代码如下:

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

我希望得到CATransition/Animation的结束事件。可能吗?

最佳答案

CAAnimation(CATransition 是其子类)具有您可以使用的委托(delegate)方法 animationDidStop:finished:

设置委托(delegate)属性并实现方法:

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

关于iphone - 如何获取CATransition/Animation的结束事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4841120/

相关文章:

iphone - 从 Non-Storyboard ViewController 转到 ViewController

iphone - IOS - 如何在滚动元素时更新元素的界面?

iphone - 警告 : Parse Issue: Use of GNU old-style field designator extension

iphone - iOS 开发 : After updating my iPhone 4 to iOS 4. 3 Beta 3,我的应用程序显示 "This game is not recognized by Game Center"

iphone - 如何在 Google 日历 API v3 中获取特定日期的日历数据?

iPhone 应用程序安装链接

iphone - 基于 token 的身份验证和刷新机制 : ios

iphone - 尽管在后台线程中调用冗长的方法,UI 仍会挂起

iPhone - 后台轮询事件

iphone - XCode 找不到基础 SDK