views:

1756

answers:

4

I'm currently using a UIImageView with an array of images to create a small looping animation sequence with about 20 images in there (at 320x480). Whilst this works okay for 20 - 30 images, any more and the app quits on the iphone. There is nothing else in my test app at the moment so I know it's just down to the animationImages sequence.

Has anyone come across any samples of doing this type of thing through Core Animation to achieve better performance and allow many more images? From what I've read it sounds like its possible to set up a ton of CALayers and put an image in each, and then create the animation by manipulating the layers on and off in sequence. Is this a good way to do it?

Or, alternatively, as I'm basically after the effect of a looping movie, is there a way to use the moviecontroller to achieve the effect without it fading in and out at the start and at the end?

I'd be grateful for any pointers. Many thanks.

+2  A: 

This could be a simple memory issue. 20 images (320x480) is about 3 MB of memory, assuming 8bpp (if they're higher color, obviously even more). You might try loading and unloading as needed (though, of course, that'll mean rolling your own animation, rather than using UIImageView).

Ben Gottlieb
Thanks Ben (and Will) - I have set up loading on demand and whilst performance isn't as great as I would like, it can handle loads of images (170 in my test). I'm currently loading from the application bundle so might try copying to local documents directory and see if that helps. Many thanks, Craig
A: 

Sounds like a simple memory issue.

You could load one or two frames at a time, or actually play a movie instead.

Will
A: 

Thanks Ben (and Will) - I have set up loading on demand and whilst performance isn't as great as I would like, it can handle loads of images (170 in my test). I'm currently loading from the application bundle so might try copying to local documents directory and see if that helps. Many thanks, Craig