问题
I apologize in advance if this question sounds dumb.
I have an array of images produced by another project, and I want to show them on the screen in sequence as fast as possible to assemble them to animation. How should I do this to achieve a frame rate at least higher than 30FPS?
I'm new to iOS development and I'm not sure where to start with. Should I look into Core Animation or OpenGL or Quartz2D or something else? Can someone please point me a direction?
Thanks a lot! Really appreciate the help.
回答1:
imageView.animationImages = imagesArray;
imageView.animationRepeatCount = 0;
imageView.animationDuration = 35;//depends on how fast you want it
imagesArray is the array of images. Each image for each frame.
Hope this helps..
回答2:
You should not be using the imageView.animationImages API. It will consume all your app memory. A complete description of the problem with Video and Memory usage on iOS devices is available. A quick fix would be to save your frames as a series of PNG images, but that will not give you 60FPS because it will take too long to decode each PNG image and blit it to the screen. The real solution that will give you 60FPS is to decode each image into "keyframes" of raw binary data in BGRA format and then memory map each frame as needed. My own code that implements this solution can be found at the link above.
来源:https://stackoverflow.com/questions/16880798/how-to-assemble-animation-from-an-array-of-images-with-the-highest-fps-possible