本身动画就是由多张图片连续播放而组成的。
UIImageView *animationImageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(50, 100, 20, 20)];
UIImage *img1 = [UIImage imageNamed:@"A..png"];
UIImage *img2 = [UIImage imageNamed:@"B.png"];
UIImage *img3 = [UIImage imageNamed:@"C.png"];
UIImage *img4 = [UIImage imageNamed:@"D.png"];
UIImage *img5 = [UIImage imageNamed:@"E.png"];
UIImage *img6 = [UIImage imageNamed:@"G.png"];
NSArray *imageFrames = [NSArray arrayWithObjects:img1,img2,img3,img4,img5,img6, nil];
// imageFrames是一个图片数组animationImageView是一个imageview
animationImageView1.animationImages = imageFrames;
[UIView setAnimationDelegate:self];
animationImageView1.animationDuration = 0.5f;
animationImageView1.animationRepeatCount = 1;
[animationImageView1 startAnimating];
[self.view addSubview:animationImageView1];