In my application there is animation of 260 images with dimension 640*1136 of .jpg file.I load all images in array as below.
On button click
- (void)singButtonClick:(id)sender
{
[self initSingArray];
[self startAnimationWithImages:singArray duration:2];
}
It will alloc init my Array, and Load all 260 images from resource folder
self.imageArray = [[NSBundle mainBundle] pathsForResourcesOfType:@"jpg" inDirectory:nil];
- (void)initSingArray
{
if (!singArray)
{
singArray=[[NSMutableArray alloc] init];
for(NSString *str in self.imageArray)
{
if([[str lastPathComponent] hasPrefix:@"Sing_"])
{
[singArray addObject:[UIImage imageNamed:[str lastPathComponent]]];
}
}
}
}
and for Image animation simply used that array and passed it to to UIImageView
- (void)startAnimationWithImages:(NSMutableArray*)images duration:(NSTimeInterval)duration
{
[self startAnimationWithImages:images duration:duration repeatCount:1];
}
- (void)startAnimationWithImages:(NSMutableArray*)images duration:(NSTimeInterval)duration repeatCount:(int)repeatCount
{
if (self.gifImageView.isAnimating)
{
[self.gifImageView stopAnimating];
}
self.gifImageView.animationImages = nil;
self.gifImageView.animationImages = images; // Animated image array
self.gifImageView.animationDuration = duration; // Perform a full animation when
self.gifImageView.animationRepeatCount = repeatCount;// Animation number of repetitions
[self.gifImageView startAnimating];
}
but when clicked on button at FIRST time it will takes long time to animating.It will works fine when there are LESS number of images.
Is the dimension of images will create problem?
Please help me to solve it out.
NOTE: I found many post related this questions but none of them is help me to resolve this problem.