-(void)tomAnimationWithName(NSString*)name count(NSInteger)count
{
//Animation image array
NSMutableArray *array = [NSMutableArray array];
//Add the flash images
for(int i = 0;i < count;i++)
{
//Name & loading pictures
NSString *imageName = [NSString stringWithFormat:@”%@_%02d.jpg”,name,i];
NSString *path = [[NSBundle mainBundle]pathForResouce:imageName ofType:nill];
UIImage *image = [UIImageimageWithContentsOfFile:path];
[array addObject:image];
}
//Set the animation array
Self .tom.animationImages = array;
//The number of repeat
Self.tom.animationRepeatCount = 1;
//Animation duration
Self.tom.animationDuration = self.tom.animationImages.count *0.1;
//
[self .tom startAnimating];
//Remove the animation
[self.tom performSelector:@selector(setAnimationImage:)withObject:nillafterDelay:self.tom animationDuration ];
}
-(IBAction) tomAnimation(UIButton *)sender
{
//currentTitle Gets the current button headline
[Self tomAnimationWithName:sender.currentTitlecount:sender.tag];
}