I’m kind of stuck with this problem. I have a UIImageView animation with 37 images where I show a glass filling with alcohol.
I initialize my image array in ViewDidLoad,
NSArray * GlassAnim = [[NSArray alloc] initWithObjects:
[UIImage imageWithContentsOfFile:
[[NSBundle mainBundle] pathForResource:@"SodaPour1" ofType:@"png"]],
[UIImage imageWithContentsOfFile:
[[NSBundle mainBundle] pathForResource:@"SodaPour39" ofType:@"png"]],
nil];
imgGlass.animationImages = GlassAnim;
imgGlass.animationDuration = 2.5;
imgGlass.contentMode = UIViewContentModeScaleAspectFit;
imgGlass.animationRepeatCount=1;
[GlassAnim release];
Then I call startAnimating when user taps the screen. But the problem is that the animation has a half a second delay for the first time. Each image has a dimension of 330*372 pixels and the file size is 180KB png files. Is there a better way to do this other than playing a video?.
Thanks.
Here you go,
You start a Timer to change image names.
Rename the images in a sequence. I have 16 images.
Eg:- “AnimationImg1.png”, “AnimationImg2.png”, “AnimationImg3.png”
That should do it 🙂