#import"ViewController.h"
@interfaceViewController()
@property(weak,nonatomic)IBOutletUIImageView*tomcatView;
@end
@implementationViewController
- (IBAction)stomach:(UIButton*)sender {
NSMutableArray*images=[NSMutableArrayarray];
for(NSUIntegeri=0; i<34; i++) {
//根据i加载图片,然后添加到可变数组images里面
NSString*imageName= [NSStringstringWithFormat:@"stomach_%02d.jpg",i];
//根据格式化的图片加载图片images
UIImage*image = [UIImageimageNamed:imageName];
//将图片images添加到数组images中
[imagesaddObject:image];
}
//设置动画图片数组
self.tomcatView.animationImages= images;
//设置动画时长
self.tomcatView.animationDuration=34*0.075;
//设置动画重复次数
self.tomcatView.animationRepeatCount=1;
//开始动画
[self.tomcatViewstartAnimating];
}
- (IBAction)right:(UIButton*)sender {
NSMutableArray*images=[NSMutableArrayarray];
for(NSUIntegeri=0; i<30; i++) {
//根据i加载图片,然后添加到可变数组images里面
NSString*imageName= [NSStringstringWithFormat:@"footleft_%02d.jpg",i];
//根据格式化的图片加载图片images
UIImage*image = [UIImageimageNamed:imageName];
//将图片images添加到数组images中
[imagesaddObject:image];
}
//设置动画图片数组
self.tomcatView.animationImages= images;
//设置动画时长
self.tomcatView.animationDuration=30*0.075;
//设置动画重复次数
self.tomcatView.animationRepeatCount=1;
//开始动画
[self.tomcatViewstartAnimating];
}
- (IBAction)left:(UIButton*)sender {
NSMutableArray*images=[NSMutableArrayarray];
for(NSUIntegeri=0; i<30; i++) {
//根据i加载图片,然后添加到可变数组images里面
NSString*imageName= [NSStringstringWithFormat:@"footright_%02d.jpg",i];
//根据格式化的图片加载图片images
UIImage*image = [UIImageimageNamed:imageName];
//将图片images添加到数组images中
[imagesaddObject:image];
}
//设置动画图片数组
self.tomcatView.animationImages= images;
//设置动画时长
self.tomcatView.animationDuration=30*0.075;
//设置动画重复次数
self.tomcatView.animationRepeatCount=1;
//开始动画
[self.tomcatViewstartAnimating];
}
- (IBAction)scratch:(UIButton*)sender {
NSMutableArray*images=[NSMutableArrayarray];
for(NSUIntegeri=0; i<56; i++) {
//根据i加载图片,然后添加到可变数组images里面
NSString*imageName= [NSStringstringWithFormat:@"scratch_%02d.jpg",i];
//根据格式化的图片加载图片images
UIImage*image = [UIImageimageNamed:imageName];
//将图片images添加到数组images中
[imagesaddObject:image];
}
//设置动画图片数组
self.tomcatView.animationImages= images;
//设置动画时长
self.tomcatView.animationDuration=56*0.075;
//设置动画重复次数
self.tomcatView.animationRepeatCount=1;
//开始动画
[self.tomcatViewstartAnimating];
}
- (IBAction)Plain:(UIButton*)sender {
NSMutableArray*images=[NSMutableArrayarray];
for(NSUIntegeri=0; i<24; i++) {
//根据i加载图片,然后添加到可变数组images里面
NSString*imageName= [NSStringstringWithFormat:@"pie_%02d.jpg",i];
//根据格式化的图片加载图片images
UIImage*image = [UIImageimageNamed:imageName];
//将图片images添加到数组images中
[imagesaddObject:image];
}
//设置动画图片数组
self.tomcatView.animationImages= images;
//设置动画时长
self.tomcatView.animationDuration=24*0.075;
//设置动画重复次数
self.tomcatView.animationRepeatCount=1;
//开始动画
[self.tomcatViewstartAnimating];
}
- (IBAction)fartAction:(UIButton*)sender {
NSMutableArray*images=[NSMutableArrayarray];
for(NSUIntegeri=0; i<28; i++) {
//根据i加载图片,然后添加到可变数组images里面
NSString*imageName= [NSStringstringWithFormat:@"fart_%02d.jpg",i];
//根据格式化的图片加载图片images
UIImage*image = [UIImageimageNamed:imageName];
//将图片images添加到数组images中
[imagesaddObject:image];
}
//设置动画图片数组
self.tomcatView.animationImages= images;
//设置动画时长
self.tomcatView.animationDuration=28*0.075;
//设置动画重复次数
self.tomcatView.animationRepeatCount=1;
//开始动画
[self.tomcatViewstartAnimating];
}
- (IBAction)cymbalAction:(UIButton*)sender {
NSMutableArray*images=[NSMutableArrayarray];
for(NSUIntegeri=0; i<13; i++) {
//根据i加载图片,然后添加到可变数组images里面
NSString*imageName= [NSStringstringWithFormat:@"cymbal_%02d.jpg",i];
//根据格式化的图片加载图片images
UIImage*image = [UIImageimageNamed:imageName];
//将图片images添加到数组images中
[imagesaddObject:image];
}
//设置动画图片数组
self.tomcatView.animationImages= images;
//设置动画时长
self.tomcatView.animationDuration=13*0.075;
//设置动画重复次数
self.tomcatView.animationRepeatCount=1;
//开始动画
[self.tomcatViewstartAnimating];
}
- (IBAction)drinkAction:(UIButton*)sender {
NSMutableArray*images=[NSMutableArrayarray];
for(NSUIntegeri=0; i<81; i++) {
//根据i加载图片,然后添加到可变数组images里面
NSString*imageName= [NSStringstringWithFormat:@"drink_%02d.jpg",i];
//根据格式化的图片加载图片images
UIImage*image = [UIImageimageNamed:imageName];
//将图片images添加到数组images中
[imagesaddObject:image];
}
//设置动画图片数组
self.tomcatView.animationImages= images;
//设置动画时长
self.tomcatView.animationDuration=81*0.050;
//设置动画重复次数
self.tomcatView.animationRepeatCount=1;
//开始动画
[self.tomcatViewstartAnimating];
}
- (IBAction)eatBirdAction:(UIButton*)sender {
NSMutableArray*images=[NSMutableArrayarray];
for(NSUIntegeri=0; i<40; i++) {
//根据i加载图片,然后添加到可变数组images里面
NSString*imageName= [NSStringstringWithFormat:@"eat_%02d.jpg",i];
//根据格式化的图片加载图片images
UIImage*image = [UIImageimageNamed:imageName];
//将图片images添加到数组images中
[imagesaddObject:image];
}
//设置动画图片数组
self.tomcatView.animationImages= images;
//设置动画时长
self.tomcatView.animationDuration=40*0.075;
//设置动画重复次数
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];
// Dispose of any resources that can be
recreated.
}
@end
网友评论