iPhone SDK:长动画与" animationImages"问题 [英] iPhone SDK: Long animations with "animationImages" problem

查看:97
本文介绍了iPhone SDK:长动画与" animationImages"问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图建立以x code长时间的动画现在,起初我开始尝试动画100 1000×1000 PNG图像,但这些图像是太大了iPhone,现在我想动画分辨率320x480 100 PNG图像,它似乎动画罚款,直到,然后应用程序崩溃,约40帧,那么,有没有不会做这个动画的任何其他方法?这可能只是因为这code加载太多的图像为iPhone来处理,是有一些其他的方法,我可以用它来获取应用程序停止崩溃?或者,我可以优化这个
code进一步?
(顺便说一下我是新来的iPhone平台,牢记回答时)

I have been trying to set up an animation in xcode for a long time now, At first I started trying to animate 100 1000x1000 pngs, but those images were too big for the iphone, now I am trying to animate 100 320x480 pngs and it seems to animate fine up until about 40 frames in, then the app crashes, so, is there any other method of animation that wouldn't do this? It's probably just because this code loads too much images for the iphone to handle, is there some other method i can use to get the app to stop crashing? Or can I optimize this code further? (By the way i'm new to the iphone platform so keep in mind when answering)

- (IBAction)startClick1:(id)sender{

spud123.animationImages = [NSArray arrayWithObjects:
						  [UIImage imageNamed: @"spud1230000.png"],
						  [UIImage imageNamed: @"spud1230001.png"],
						  [UIImage imageNamed: @"spud1230002.png"],
						  [UIImage imageNamed: @"spud1230003.png"],
						  [UIImage imageNamed: @"spud1230004.png"],
						  [UIImage imageNamed: @"spud1230005.png"],
						  [UIImage imageNamed: @"spud1230006.png"],
						  [UIImage imageNamed: @"spud1230007.png"],
						  [UIImage imageNamed: @"spud1230008.png"],
						  [UIImage imageNamed: @"spud1230009.png"],
						  [UIImage imageNamed: @"spud1230010.png"],
						  [UIImage imageNamed: @"spud1230011.png"],
						  [UIImage imageNamed: @"spud1230012.png"],
						  [UIImage imageNamed: @"spud1230013.png"],
						  [UIImage imageNamed: @"spud1230014.png"],
						  [UIImage imageNamed: @"spud1230015.png"],
						  [UIImage imageNamed: @"spud1230016.png"],
						  [UIImage imageNamed: @"spud1230017.png"],
						  [UIImage imageNamed: @"spud1230018.png"],
						  [UIImage imageNamed: @"spud1230019.png"],
						  [UIImage imageNamed: @"spud1230020.png"],
						  [UIImage imageNamed: @"spud1230021.png"],
						  [UIImage imageNamed: @"spud1230022.png"],
						  [UIImage imageNamed: @"spud1230023.png"],
						  [UIImage imageNamed: @"spud1230024.png"],
						  [UIImage imageNamed: @"spud1230025.png"],
						  [UIImage imageNamed: @"spud1230026.png"],
						  [UIImage imageNamed: @"spud1230027.png"],
						  [UIImage imageNamed: @"spud1230028.png"],
						  [UIImage imageNamed: @"spud1230029.png"],
						  [UIImage imageNamed: @"spud1230030.png"],
						  [UIImage imageNamed: @"spud1230031.png"],
						  [UIImage imageNamed: @"spud1230032.png"],
						  [UIImage imageNamed: @"spud1230033.png"],
						  [UIImage imageNamed: @"spud1230034.png"],
						  [UIImage imageNamed: @"spud1230035.png"],
						  //and so on to 100
						  nil];

[spud123 setAnimationRepeatCount:1];
spud123.animationDuration =5.7;
[spud123 startAnimating];

}

诗:Iv'e试过的NSTimer,但我不能得到制止重复动画

Ps: Iv'e tried NSTimer, but I can't get that to stop repeating the animation

推荐答案

这是不是一个动画的问题这是一个设计问题。

This is not an animation problem it's a design problem.

首先,只是走一步CACK和计算应用程序的内存需求:
当DECOM pressed各那些PNG格式的使用614400字节。所以他们百使用61440000字节:超过60兆字节。这是一个有点多从手机的期望。

First off, just take a step cack and calculate your application's memory requirements: When decompressed, each of those PNGs uses 614400 bytes. So a hundred of them use 61440000 bytes: over 60 megabytes. That's a little much to expect from a phone.

如果你真的需要为每一帧显示不同的图像,你应该使用视频。视频有很多技术,COM preSS图像和减少处理和内存需求顺序显示大量的大图像时。

If you really need to display a different image for every frame, you should be using video. Video has a lot of technology to compress images and reduce the processing and memory requirements when displaying a lot of large images sequentially.

如果您需要这是更多的控制动画,我建议你要分析什么是移动,只有动态显示 - 绘制一个背景,然后在该动画较小的图像

If you need this to be an animation with more control, I suggest you need to analyse what is moving and only animate that - draw a single background and then animate smaller images over that.

最后,如果这个办法行不通,你将不得不的了解的OpenGL 达到你所需要的性能。

Finally, if this approach doesn't work, you are going to have to learn OpenGL to achieve the performance you need.

不知道更多关于你的应用程序,它是很难提供意见。

Without knowing more about your app, it is difficult to advise.

这篇关于iPhone SDK:长动画与" animationImages"问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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