Tom猫

1.//按钮函数

- (IBAction)beginAction:(UIButton*)sender {

NSLog(@"我做动作了");

switch(sender.tag) {

case100:{

//执行核心功能模块

[selfanimationImageNmae:@"cymbal"WithAccount:13];

}break;

case101:{

[selfanimationImageNmae:@"fart"WithAccount:28];

}break;

case102:

[selfanimationImageNmae:@"eat"WithAccount:40];

break;

case103:

[selfanimationImageNmae:@"drink"WithAccount:81];

break;

case104:

[selfanimationImageNmae:@"scratch"WithAccount:56];

break;

case105:

[selfanimationImageNmae:@"pie"WithAccount:24];

break;

case106:

[selfanimationImageNmae:@"stomach"WithAccount:34];

break;

case107:

[selfanimationImageNmae:@"foot_right"WithAccount:30];

break;

case108:

[selfanimationImageNmae:@"foot_left"WithAccount:30];

break;

case109:

[selfanimationImageNmae:@"knockout"WithAccount:81];

break;

case110:

[selfanimationImageNmae:@"angry"WithAccount:26];

break;

default:

break;

}

}

2.//核心功能模块

-(void)animationImageNmae:(NSString*)name WithAccount:(int)count{

//新建数组

NSMutableArray*tempArray = [NSMutableArraynew];

//往数组里加图片

for(intindex=0;index

//找图片

NSString*imageName=[NSStringstringWithFormat:@"%@_%02d.jpg",name,index];

UIImage*image=[UIImageimageNamed:imageName];

//把图片放到数组

[tempArrayaddObject:image];

}

//把图片给图片试图

self.backImageView.animationImages=tempArray;

//设置动画的执行次数

self.backImageView.animationRepeatCount=1;

//动画的执行时间

self.backImageView.animationDuration=0.1*count;

//开始动画

[self.backImageViewstartAnimating];

}

你可能感兴趣的:(Tom猫)