Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I ran some tests a while back. Managed to max out around 40 frames of around 20K PNGs before UIImageview animation gave up and borked.</p> <p>If you need more than that, you can either switch to use video or write your own animation rendering engine. The rendering engine is pretty straightforward. It would run on a timer that fetches an already loaded UIImage from the head of a queue, updates the view then releases the image. A separate thread preloads a few frames ahead at the tail end of the queue. This way, you have at most N frames in memory at any given time. You can tweak it to find the optimum balance between timer delay and number of frames to pre-load for your app.</p> <p>A project I worked on used that technique to display hundreds of large images with no problems.</p> <p>A few tips:</p> <ul> <li><p>Use CALayers as much as you can.</p></li> <li><p>Don't do ANY scaling when displaying each frame. Try to make each source image the exact size you want displayed.</p></li> <li><p>Try not to cover the animation with other views. It'll slow things down.</p></li> <li><p>You can load the image list from the bundle or by scanning a directory. The disadvantage of bundle is that the images can't be updated without updating the whole app. The disadvantage of loading from a directory is that on first startup you'll have to copy the images from the bundle to a writable location and your app size at runtime gets larger. The main benefit is that you can update the media in that directory via the net.</p></li> <li><p>Sound synchronization becomes a bit dicey. You'll have to come up with your own way to designate when to start/stop sounds. If you have sound and need it to be precise (like lip-synching) going the video route might be more practical.</p></li> </ul> <p>Good luck.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload