iPhone - 捕捉分组动画的结尾
我对 2 个视图进行动画处理,每个视图都有其包含 2 个 CAAnimation 的 CAAnimationGroup。它们同时启动(如果计算时间可以忽略不计),并且具有相同的持续时间。
我怎样才能知道两个分组动画何时完成。
我放置了 - (void)animationDidStop:(CAAnimation *)theAnimation finish:(BOOL)flag
委托方法,但是...我可以测试什么?听起来很简单,但我不知道这样做的方法。
I animate 2 views, each one with its CAAnimationGroup that contains 2 CAAnimations. They are launched at the same time (if computing time is negligible), and have the same duration.
How may I do to know when both grouped animation is finished.
I put the - (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag
delegate method, but... What may I test ? Sounds simple, but I don't see the way of doing this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用两个变量来跟踪动画是否已完成:
然后在animationDidStop 委托中检查哪个动画正在调用该方法并相应地设置标志。问题是,当动画调用委托时,您需要添加一个键来识别动画(您创建的动画不会是调用委托的动画,这是另一个问题/咆哮的主题)。例如:
You can use two variables to track whether the animations have completed:
then in your animationDidStop delegate you check which animation is calling the method and set the flags appropriately. The catch is that you'll need to add a key to identify the animations when they call the delegate (the animations you created will not be the ones calling the delegate, which is a subject for another question/rant). For example: