用于animationDidStop的CABasicAnimation委托?

use*_*733 15 iphone cabasicanimation

我按照页面底部的示例来调用animationDidStop函数.

http://www.informit.com/articles/article.aspx?p=1168314&seqNum=2

作者说:

我有一个专门设计为动画委托的对象,它所做的就是保存对目标对象的引用,接受animationDidStop:消息然后释放自己.

这表明你不应该这样做:

[animation setDelegate:self];
Run Code Online (Sandbox Code Playgroud)

我对应用程序编程很新,有人可以概述我怎么做这个吗?或者给我一个解释它的链接.

the*_*faj 38

实行:

- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag
Run Code Online (Sandbox Code Playgroud)

在你的委托对象上.你也可以实现:

- (void)animationDidStart:(CAAnimation *)theAnimation
Run Code Online (Sandbox Code Playgroud)

在动画开始时接收呼叫.

有关详细信息,请参阅代理部分:http: //developer.apple.com/iphone/library/documentation/GraphicsImaging/Reference/CAAnimation_class/Introduction/Introduction.html

  • 这是正确的答案.为什么有人投票反对,特别是没有评论? (8认同)