Reputation: 82
I have a set of ~400 PNG images that I am current using UIImageView
to animate. This is in Objective C for iOS 7.
I was wondering if there is a more efficient way to display this animation?
For information, the animation will be on one part of the screen in the background, while other actions are taking place.
Upvotes: 0
Views: 235
Reputation: 131511
400 images is a lot of images. If these images are large, you are going to eat up a lot of memory in displaying them, and may crash. (Images in memory take 3 bytes per pixel, or 4 bytes if the image has an alpha channel as most PNG images do.) For a a 400 x 400 point retina image (800x800 pixels) that's 800x800x4, or 2,560,000 bytes per image. With 400 image, that's 1,024,000,000 bytes, or about 976 MB. Way, way more than you should take for a single animation in your app.
You might want to convert the image sequence into a video and display the video in your app. Video uses hardware-accellerated streaming that only loads a frame at a time into memory.
Upvotes: 1