标签:
------------- ViewController.m -------------
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
- (IBAction)drink;
- (IBAction)konckOut;
- (IBAction)footLeft;
@end
@implementation ViewController
- (IBAction)drink
{
if(self.imageView.isAnimating)
{
return;
}
NSMutableArray *images = [NSMutableArray array];
for (int i = 0; i < 81; i++)
{
NSString *imageName = [NSString stringWithFormat:@"drink_%02d", i];
UIImage *image = [UIImage imageNamed:imageName];
[images addObject:image];
}
self.imageView.animationImages = images;
self.imageView.animationDuration = 0.05 * 81;
self.imageView.animationRepeatCount = 1;
[self.imageView startAnimating];
}
- (IBAction)konckOut
{
if(self.imageView.isAnimating)
{
return;
}
NSMutableArray *images = [NSMutableArray array];
for (int i = 0; i < 81; i++)
{
NSString *imageName = [NSString stringWithFormat:@"knockout_%02d", i];
UIImage *image = [UIImage imageNamed:imageName];
[images addObject:image];
}
self.imageView.animationImages = images;
self.imageView.animationDuration = 0.05 * 81;
self.imageView.animationRepeatCount = 1;
[self.imageView startAnimating];
}
- (IBAction)footLeft
{
if(self.imageView.isAnimating)
{
return;
}
NSMutableArray *images = [NSMutableArray array];
for (int i = 0; i < 30; i++)
{
NSString *imageName = [NSString stringWithFormat:@"footLeft_%02d", i];
UIImage *image = [UIImage imageNamed:imageName];
[images addObject:image];
}
self.imageView.animationImages = images;
self.imageView.animationDuration = 0.05 * 30;
self.imageView.animationRepeatCount = 1;
[self.imageView startAnimating];
}
@end
标签:
原文地址:http://www.cnblogs.com/lixiang2015/p/4696958.html