I'm trying to run small, full screen, 1 second long animations using the 
UIImageView animationImages property. The animation consists of a maximum of 9 
frames, running at 18 frames per second. UIImages are re-used in the image 
array to conserve memory. Each time an animation runs, a new set of images is 
first assigned to the UIImageView and then -startAnimation is called.

My controller's code:

[self preloadAnimation]; /* sets up the animationImages */
[imageView startAnimating];

The problem I experiece is that the animation is not smooth. Most of the time 
there is a short delay, after which the first frames are 'rushed' out to catch 
up with 'animated time'. Sometimes the animation doesn't run at all.

I've found that the following helps to work around this:

[self preloadAnimation];
[imageView startAnimating];
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate 
dateWithTimeIntervalSinceNow:1.0/FPS]];
[imageView stopAnimating];
[imageView startAnimating];

It seems that starting animation just for a short while triggers all images to 
be loaded into memory before the animation starts running. Although it works 
for the moment, it looks quite fragile and not something I want to use in my 
final code.

Is there a better solution to get animationImages to work reliably? Am I doing 
something wrong? Can I force loading of my UIImage array 'by hand'?

patrick_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to