//
//ViewController.m
//hh
//
//Created by lanouhn on 16/7/12.
//Copyright © 2016年lanouhn. All rights
reserved.
//
#import"ViewController.h"
@interfaceViewController()
@property(weak,nonatomic)IBOutletUIImageView*tomcatView;
@end
@implementationViewController
- (IBAction)eat:(UIButton*)sender {
NSMutableArray*images = [NSMutableArrayarray];
for(NSIntegeri=0;i<40;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString*imageNamed = [NSStringstringWithFormat:@"eat_%02ld.jpg",i];
UIImage*image = [UIImageimageNamed:imageNamed];
[imagesaddObject:image];
}
self.tomcatView.animationImages= images;
self.tomcatView.animationDuration=40*0.075;
self.tomcatView.animationRepeatCount=1;
[self.tomcatViewstartAnimating];
}
- (IBAction)drink:(UIButton*)sender {
NSMutableArray*images = [NSMutableArrayarray];
for(NSIntegeri=0;i<80;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString*imageNamed = [NSStringstringWithFormat:@"drink_%02ld.jpg",i];
UIImage*image = [UIImageimageNamed:imageNamed];
[imagesaddObject:image];
}
self.tomcatView.animationImages= images;
self.tomcatView.animationDuration=80*0.1;
self.tomcatView.animationRepeatCount=1;
[self.tomcatViewstartAnimating];
}
- (IBAction)fart:(UIButton*)sender {
NSMutableArray*images = [NSMutableArrayarray];
for(NSIntegeri=0;i<27;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString*imageNamed = [NSStringstringWithFormat:@"fart_%02ld.jpg",i];
UIImage*image = [UIImageimageNamed:imageNamed];
[imagesaddObject:image];
}
self.tomcatView.animationImages= images;
self.tomcatView.animationDuration=27*0.1;
self.tomcatView.animationRepeatCount=1;
[self.tomcatViewstartAnimating];
}
- (IBAction)pie:(UIButton*)sender {
NSMutableArray*images = [NSMutableArrayarray];
for(NSIntegeri=0;i<23;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString*imageNamed = [NSStringstringWithFormat:@"pie_%02ld.jpg",i];
UIImage*image = [UIImageimageNamed:imageNamed];
[imagesaddObject:image];
}
self.tomcatView.animationImages= images;
self.tomcatView.animationDuration=23*0.1;
self.tomcatView.animationRepeatCount=1;
[self.tomcatViewstartAnimating];
}
- (IBAction)cymbal:(UIButton*)sender {
//创建一个可变数组,用来存放要用的图片
NSMutableArray*images = [NSMutableArrayarray];
//用for循环确定图片名添加图片
for(NSIntegeri=0;i<12;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString*imageNamed = [NSStringstringWithFormat:@"cymbal_%02ld.jpg",i];
//根据格式化的图片名加载图片image
UIImage*image = [UIImageimageNamed:imageNamed];
//将图片image添加到数组images中
[imagesaddObject:image];
}
self.tomcatView.animationImages= images;
self.tomcatView.animationDuration=12*0.1;
//self.tomcatView.animationRepeatCount = 1;
[self.tomcatViewstartAnimating];
}
- (IBAction)scratch:(UIButton*)sender {
NSMutableArray*images = [NSMutableArrayarray];
for(NSIntegeri=0;i<55;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString*imageNamed = [NSStringstringWithFormat:@"scratch_%02ld.jpg",i];
UIImage*image = [UIImageimageNamed:imageNamed];
[imagesaddObject:image];
}
self.tomcatView.animationImages= images;
self.tomcatView.animationDuration=55*0.1;
self.tomcatView.animationRepeatCount=1;
[self.tomcatViewstartAnimating];
}
- (IBAction)angry:(UIButton*)sender {
NSMutableArray*images = [NSMutableArrayarray];
for(NSIntegeri=0;i<25;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString*imageNamed = [NSStringstringWithFormat:@"Angry_%02ld.jpg",i];
UIImage*image = [UIImageimageNamed:imageNamed];
[imagesaddObject:image];
}
self.tomcatView.animationImages= images;
self.tomcatView.animationDuration=25*0.1;
self.tomcatView.animationRepeatCount=1;
[self.tomcatViewstartAnimating];
}
- (IBAction)footleft:(UIButton*)sender {
NSMutableArray*images = [NSMutableArrayarray];
for(NSIntegeri=0;i<29;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString*imageNamed = [NSStringstringWithFormat:@"FootRight_%02ld.jpg",i];
UIImage*image = [UIImageimageNamed:imageNamed];
[imagesaddObject:image];
}
self.tomcatView.animationImages= images;
self.tomcatView.animationDuration=29*0.1;
self.tomcatView.animationRepeatCount=1;
[self.tomcatViewstartAnimating];
}
- (IBAction)footright:(UIButton*)sender {NSMutableArray*images = [NSMutableArrayarray];
for(NSIntegeri=0;i<29;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString*imageNamed = [NSStringstringWithFormat:@"FootLeft_%02ld.jpg",i];
UIImage*image = [UIImageimageNamed:imageNamed];
[imagesaddObject:image];
}
self.tomcatView.animationImages= images;
self.tomcatView.animationDuration=29*0.1;
self.tomcatView.animationRepeatCount=1;
[self.tomcatViewstartAnimating];
}
- (IBAction)stomach:(UIButton*)sender {
NSMutableArray*images = [NSMutableArrayarray];
for(NSIntegeri=0;i<33;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString*imageNamed = [NSStringstringWithFormat:@"Stomach_%02ld.jpg",i];
UIImage*image = [UIImageimageNamed:imageNamed];
[imagesaddObject:image];
}
self.tomcatView.animationImages= images;
self.tomcatView.animationDuration=33*0.1;
self.tomcatView.animationRepeatCount=1;
[self.tomcatViewstartAnimating];
}
- (IBAction)knockout1:(UIButton*)sender {
NSMutableArray*images = [NSMutableArrayarray];
for(NSIntegeri=0;i<80;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString*imageNamed = [NSStringstringWithFormat:@"Knockout_%02ld.jpg",i];
UIImage*image = [UIImageimageNamed:imageNamed];
[imagesaddObject:image];
}
self.tomcatView.animationImages= images;
self.tomcatView.animationDuration=80*0.1;
self.tomcatView.animationRepeatCount=1;
[self.tomcatViewstartAnimating];
}
- (IBAction)knockout2:(UIButton*)sender {
NSMutableArray*images = [NSMutableArrayarray];
for(NSIntegeri=0;i<80;i++) {
//根据i来加载图片,然后添加到可变数组images里面
NSString*imageNamed = [NSStringstringWithFormat:@"Knockout_%02ld.jpg",i];
UIImage*image = [UIImageimageNamed:imageNamed];
[imagesaddObject:image];
}
self.tomcatView.animationImages= images;
self.tomcatView.animationDuration=80*0.1;
self.tomcatView.animationRepeatCount=1;
[self.tomcatViewstartAnimating];
}
- (void)viewDidLoad {
[superviewDidLoad];
UIImageView*imageview=[UIImageViewnew];
//序列帧动画要播放的图片数组
//imageview.animationImages
//动画时长
//imageView.animationDuration
//动画重复次数
//imageView.animationRepeatCount
//开始动画
//[imageView.startAnimating];
//结束动画
//[imageView.stopAnimating];
//是否正在执行动画
//[imageView isAnimating];
}
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
}
@end