I need to play frame based animations. I tried the UIImageView with animationImages but it doesn’t give me any control over my animation. I can’t pause it, I can’t mask it, I can’t know the current frame etc.
So I subclassed UIView and created something I called AnimationView which takes the array of images and does the animation using an NSTimer. In the drawRect: I can then do all the masking and everything else I want.
However this method is way too slow. I can’t run an animation at 30fps, maybe not even at 10fps and I am testing on a 3GS. (I am only doing masking and blending on every frame 🙂 – and using the same images plays fine at 30fps on a UIImageView).
So, what is the most efficient way to achieve this? Is the NSTimer a bad choice? Is there a better way around it?
Thanks 🙂
In this answer to this question Mo DeJong provides a link to a source code implementation of a class that manually animates PNG image frames. He claims to get 15 FPS for 480×320 images animating on a non-3GS iPhone.