有没有办法暂停一个核心动画,并在以后恢复它? [英] Is there an way to pause an Core Animation and resume it at some time later?

查看:106
本文介绍了有没有办法暂停一个核心动画,并在以后恢复它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个核心动画在同一时间。它们都有一个上下文和一个动画id,其中上下文是beeing动画的对象(UIImageView对象)。我想暂停他们,使动画只是暂时停止,然后当一些事情完成后,恢复它来完成它。这些事情只发生在UIScrollView中非常快的滚动移动。我想通过停止所有正在进行的动画,而不是使滚动视图滚动来提高性能。我已经为该滚动视图实现了contentOffset的自定义动画。

I have several Core Animation's going on at the same time. They all have an context and an animation id, where the context is the object that's beeing animated (UIImageView objects). I would like to pause them, so that the animation just stops temporarily, and then when some things are done, resume it to complete it. These things happen only on very fast scroll movements in an UIScrollView. I want to improve performance by stopping all ongoing animations but not the one that makes the scroll view scroll. I have implemented an custom animation of the contentOffset for that scroll view.

推荐答案

您可以通过设置动画为零,请参阅如何暂停图层树的动画< a>。

You can pause layer animations by setting the speed of the animation to zero, see How to pause the animation of a layer tree.

这篇关于有没有办法暂停一个核心动画,并在以后恢复它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆