简体   繁体   English

对多个UIVIew进行动画处理会导致问题

[英]Animating multiple UIVIew cause problems

In my current iPhone game project I am using UIView that are some game play elements (they are tiles). 在我当前的iPhone游戏项目中,我正在使用UIView,它们是一些游戏元素(它们是图块)。 Animating one by one is working well, or in a small series (5 UIView animating at the same time). 逐个动画效果很好,或者按小系列制作(同时制作5个UIView动画)。

But once I decided to animate those same UIView more massively together I am starting to get some weird rendering issue (the whole iPod touch screen turning black then flashing back to the game view once the animation is done or nearly done, in other case the screen is flickering between black and the actual game view while it's trying to animate). 但是一旦我决定更大规模地对那些相同的UIView进行动画处理,我就开始遇到一些奇怪的渲染问题(整个iPod触摸屏变黑,然后在动画完成或接近完成后又闪回游戏视图,在其他情况下为屏幕在尝试制作动画时,在黑色和实际游戏视图之间闪烁)。

I've done several test and so far its seems that up to 18 UIView being animated I don't have any issue, but once I get to 30 UIView I am seeing this rendering problems. 我已经进行了几次测试,到目前为止,似乎多达18个UIView处于动画状态,我没有任何问题,但是一旦达到30个UIView,我就会看到此渲染问题。 And the animation transition I am using is the the Flip from right. 我正在使用的动画过渡是从右翻转。

Is there a maxiumum of animation thread that can be run at once? 是否可以同时运行最多数量的动画线程?

I am calling a method on my subclass UIView which do the standard begin animation commit animations. 我在子类UIView上调用一个方法,该方法执行标准的开始动画提交动画。 And I am setting the cache to YES. 我将缓存设置为“是”。

Any ideas what could be the cause of the rendering bug? 有什么想法可能是渲染错误的原因吗?

Thanks for your collaboration in advance. 感谢您的提前配合。

There is not an explicit maximum of animations that can run at the same time. 没有可以同时运行的动画的最大数量。

But, every animation will use memory and CPU usage. 但是,每个动画都会使用内存和CPU使用率。 This of course greatly depends on the kind of animation you are doing. 当然,这很大程度上取决于您正在执行的动画类型。

So you are probably trying to do too much animation at the same time. 因此,您可能试图同时做太多动画。

Using the UIView animation is great for many thing, but sometimes you have to use something more appropriate like OpenGL. 使用UIView动画在很多方面都很有用,但是有时您必须使用更合适的东西,例如OpenGL。 Maybe you are in that situation. 也许你处于那种情况。

You may be running into memory issues, or GPU limits, if trying to do a lot with UIView animations. 如果尝试对UIView动画做很多事情,则可能会遇到内存问题或GPU限制。 You MAY want to try doing this with layers, but there are limits to what the GPU can handle. 您可能想尝试对图层进行此操作,但是GPU可以处理的内容是有限的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM