动画的UIImageView在落后第一次运行 [英] UIImageView animations lag at first run

查看:127
本文介绍了动画的UIImageView在落后第一次运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一系列的,在我的应用程序中播放的图像(这只是得到了一个视图/的ViewController)。每当我运行应用程序,我第一次播放动画,它会有点滞后首次动画被告知要发挥。

I have a series of images that play in my application (it's only got one view/viewcontroller). Whenever I run the app, the first time I play an animation, it will lag a bit the first time the animation is told to play.

我通过不同的方法(例如,animateJump),这是负责加载正确的帧,然后播放动画运行我的动画。动画结束后,我(据说)释放从UIImageView的动画,把后面一个框架中显示。 (我说据说,因为如果动画只落后他们跑的第一次,他们真的是从内存释放?)

I run my animations via different methods (e.g. "animateJump") which are responsible for loading the correct frames, then playing the animation. After the animation finishes, I (supposedly) release the animation from the UIImageView, putting back a single frame to display. (I say supposedly because if the animations are only lagging the first time they run, are they really being release from memory?)

那么,有没有一个简单的解决这个?我有大约100动画我去来回的帧。如果我只是加载它们都到内存在应用程序的启动?你会怎么做?

So is there a simple fix to this? I have about 100 frames of animation I go back and forth through. Should I just load them all into memory at the application's start up? What would you do?

- 德里克

推荐答案

如果你已经有了一段时间加载,我D可能在使用它,而它隐藏/非可视运行动画。

If you've already got a period of loading, I"d probably use it to run the animation whilst it's hidden/non-viewable.

这篇关于动画的UIImageView在落后第一次运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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