I create a 5-frame animation on UImageView and each image is created by [UIImage imageWithContentOfFile:xxx], however, the animation on simulator is working well but not on device, it usually has ~1 sec delay though the animation duration is 1sec.
This is my code.
NSArray *animations = [[NSBundle mainBundle] pathsForResourcesOfType:@"png" inDirectory:@"ShakeAnimation"];
UIImageView *imgView = [[UIImageView alloc]initWithImage:[UIImage imageWithContentsOfFile:[animations objectAtIndex:0]]];
imgView.tag = 10;
NSMutableArray *animationImgs = [[NSMutableArray alloc] init];
for( NSString *path in animations )
{
[animationImgs addObject:[UIImage imageWithContentsOfFile:path]];
}
[imgView setAnimationRepeatCount:2];
[imgView setAnimationImages:animationImgs];
[imgView setAnimationDuration:1];
[animationImgs release];
and when the view controller recieved shack event, it calls [imgView startAnimation];
Is anyway to preload the images involved in the animation? thanks.