Problem: I have made a class which plays a big 300 x 300 px image sequence animation of 100 frames. This class has a -start method that kicks off the animation, and then a -animate: method that walks through the frames. At every frame it fetches the big chunk of bitmap data from a png, wraps that into an UIImage and assigns that to an UIImageView's image property. Then it calls a delayed selector on itself to take the next frame:
[self performSelector:@selector(animate:) withObject:nil afterDelay:delay];
the animation itself is smooth, but the whole UI freezes up until it finished. On the iPhone Simulator the UI does not freeze. So I assume CPU is running at 100% when performing this animation.
Now the question is: What kind of multithreading-technique or strategy could help out in a situation like this?
Should I start looking at POSIX? Or any other API / Library / Framework? Or should I rely on the NSObject methods for creating threads or use NSThread for that?
I tried to put the whole animation into a new NSThread thread, but that doesn't help anything. As far as I know, I have to call any UI code on the main thread. So when updating the image property of the UIImageView during the animation, this has to be done on the main thread. So the only real part where I could "save time" for the UI-rensponsiveness is when fetching the bitmap data out of the PNG? Or is there something else that would help out?