#import "ViewController.h"
@interface ViewController ()
@property(nonatomic,strong) NSMutableArray *loadImagesArray;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
_loadImagesArray = [[NSMutableArray alloc] init];
for (int i=1; i<=19; i++) {
UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"loading_%d.png",i]];
[_loadImagesArray addObject:image];
}
//180*72 图片大小
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake((self.view.frame.size.width-90)*0.5, (self.view.bounds.size.height-36)*0.5, 90, 36)];
imageView.animationImages = _loadImagesArray;
imageView.tag = 1000;
imageView.animationDuration = 1;
imageView.animationRepeatCount = 0;
[imageView startAnimating];
[self.view addSubview:imageView];
[self performSelector:@selector(stopAnimating) withObject:nil afterDelay:5];
}
- (void)stopAnimating
{
UIImageView *image = [self.view viewWithTag:1000];
[image stopAnimating];
}
UIImageView 实现一组动画
最新推荐文章于 2019-05-13 17:16:52 发布