I am trying to draw images to the iphone screen by changing the images of a UIImageView in a loop. But since there was no much response on the screen than two or three images being drawn and skipping others I need another method.
我试图通过在循环中更改UIImageView的图像来将图像绘制到iphone屏幕。但是由于屏幕上没有多少响应而是绘制了两三张图像并且跳过了其他图像,我需要另一种方法。
I am trying to show 80 png images that are 320*480 in size at 30 images per second.
我试图以每秒30张图像显示尺寸为320 * 480的80 png图像。
Please suggest the fastest method to do this. And some sample code if available.
请建议最快的方法来做到这一点。以及一些示例代码(如果有)。
Thanks
谢谢
3 个解决方案
#1
0
Well, keeping 80 images of that size in memory will use roughly 50 MB of memory. Do you have that kind of memory available on the device?
好吧,在内存中保留80个这样大小的图像将使用大约50 MB的内存。你在设备上有这种内存吗?
#2
0
Some context would be helpful. Why do you need to display the images so quickly, and do they have to be PNG and do they have to be separate?
一些上下文会有所帮助。为什么你需要如此快速地显示图像,并且它们必须是PNG并且必须分开吗?
By far the fastest way to draw successive images to the screen is by putting them into a movie file. This allows you to use frameworks specifically designed for drawing frames to the screen in the fastest possible manner.
到目前为止,将连续图像绘制到屏幕的最快方法是将它们放入电影文件中。这允许您以最快的方式使用专门用于绘制帧的框架到屏幕。
Check out Apple's documentation on how to play video files in your app: Using Video in iPhone OS.
查看Apple有关如何在您的应用中播放视频文件的文档:在iPhone OS中使用视频。
If you relax the quality of your images you might see a performance gain. Try using less color depth for sure. Remember that you are testing your app in the ideal scenario, nothing else it taking up very much processor time. But on a real world iPhone, the user could be doing any number of things.
如果放松图像质量,您可能会看到性能提升。尝试使用较少的颜色深度。请记住,您正在理想的情况下测试您的应用程序,没有其他任何东西占用非常多的处理器时间。但在现实世界的iPhone上,用户可以做任何事情。
#3
0
The fastest drawing method on the iPhone is OpenGL ES. :) If you make some texture atlases with your images you'll achieve what you want.
iPhone上最快的绘图方法是OpenGL ES。 :)如果你用你的图像制作一些纹理图册,你就可以达到你想要的效果。
#1
0
Well, keeping 80 images of that size in memory will use roughly 50 MB of memory. Do you have that kind of memory available on the device?
好吧,在内存中保留80个这样大小的图像将使用大约50 MB的内存。你在设备上有这种内存吗?
#2
0
Some context would be helpful. Why do you need to display the images so quickly, and do they have to be PNG and do they have to be separate?
一些上下文会有所帮助。为什么你需要如此快速地显示图像,并且它们必须是PNG并且必须分开吗?
By far the fastest way to draw successive images to the screen is by putting them into a movie file. This allows you to use frameworks specifically designed for drawing frames to the screen in the fastest possible manner.
到目前为止,将连续图像绘制到屏幕的最快方法是将它们放入电影文件中。这允许您以最快的方式使用专门用于绘制帧的框架到屏幕。
Check out Apple's documentation on how to play video files in your app: Using Video in iPhone OS.
查看Apple有关如何在您的应用中播放视频文件的文档:在iPhone OS中使用视频。
If you relax the quality of your images you might see a performance gain. Try using less color depth for sure. Remember that you are testing your app in the ideal scenario, nothing else it taking up very much processor time. But on a real world iPhone, the user could be doing any number of things.
如果放松图像质量,您可能会看到性能提升。尝试使用较少的颜色深度。请记住,您正在理想的情况下测试您的应用程序,没有其他任何东西占用非常多的处理器时间。但在现实世界的iPhone上,用户可以做任何事情。
#3
0
The fastest drawing method on the iPhone is OpenGL ES. :) If you make some texture atlases with your images you'll achieve what you want.
iPhone上最快的绘图方法是OpenGL ES。 :)如果你用你的图像制作一些纹理图册,你就可以达到你想要的效果。