什么显示出更好的性能?使用 UIImageView 播放影片剪辑或动画图像序列?
规格:约 320 x 270 像素,5 秒。我不知道流畅的动画到底需要多少图像,但我们假设 30 个。
播放此图像的最佳方式是什么?作为某种 Quicktime 视图中的电影文件(如果可用),或者作为 UIImageView 的动画图像序列?我不确定,但我相信在 iPod touch 上每秒加载 30 张图像几乎是不可能的。有什么想法吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一般来说,电影会应用一些压缩,甚至可能使用有损压缩。这意味着处理器需要更加努力地工作,但可供读取的内存却少得多。 CPU 是一种快速资源。与CPU相比,内存速度较慢。因此,压缩的电影(逻辑上)将具有更好的性能。
实际上,这可能取决于很多因素,尽管电影确实往往针对动画进行了更好的优化。如果 CPU 较慢且内存速度极快,多图像动画可能会更快。此外,这还取决于您存储这些图像的方式。但99%的情况下,电影都会有更好的表现。
In general, a movie will have applied some compression and possibly even used a lossy compression. This means the processor would need to work harder but it has a lot less memory to read. The CPU is a fast resource. Compared to the CPU, memory is slow. Thus a compressed movie would (logically) have the better performance.
In practice, it could depend on a lot of factors, although movies do tend to be better optimized for animations. With a slow CPU and extremely fast memory, a multi-image animation might just be faster. Also, it depends on how you store those many images. But in 99% of all situations, movies will have better performance.
好吧,我想这取决于……如果它应该是静态的,那么电影是最合适的方式……它是硬件加速的,并且很容易编写使用它的代码。如果您打算修改动画并重用它,您可以加载和修改图像,或者连续加载一堆图像,但我认为这对于该任务来说是相当大的编码过度。
Well, I guess it depends.... if it supposed to be static, than a movie is the most appropriate way... it's hardware accelerated, and easy to write the code for using it. If you plan to modify the animation, and reuse it, you could load and modify images, or load a bunch of them in succession, but I imagine it's quite coding overkill for the task.
为什么您不想想要使用视频文件?如果您没有非常具体的原因,我建议您仅使用Apple提供的标准视频播放功能。
这给你带来了几个优点:
查看此内容以开始使用:
http://developer.apple.com/iphone/library/navigation/index.html?section=Topics&topic=Audio%20%26amp%3B%20Video
Why would you not want to use a video file? If you don't have very specific reasons, I would recommend just using the standard video playback functions provided by Apple.
This gives you several advantages:
Check out this to get started:
http://developer.apple.com/iphone/library/navigation/index.html?section=Topics&topic=Audio%20%26amp%3B%20Video