Tom-猫

来源:互联网 发布:java.util.TimeZone 编辑:程序博客网 时间:2024/05/16 00:25

-(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];

 

}

0 0
原创粉丝点击