UIImageView 动画

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
   
   
    //显示图片的UIImageView
    UIImageView *imageview=[[UIImageView alloc]initWithFrame:CGRectMake(50, 100, 200, 200)];
    imageview.backgroundColor=[UIColor redColor];
    [self.view addSubview:imageview];
   
    //动画的实现
    NSMutableArray * images = [NSMutableArray arrayWithCapacity:6];
    for (int i = 1; i <= 6; i++)
    {
        NSString * imageName = [NSString stringWithFormat:@"%d.jpg",i];
        UIImage * image = [UIImage imageNamed:imageName];
       
        [images addObject:image];
    }
    imageview.animationImages = images;
    imageview.animationDuration = 0.3;
    [imageview startAnimating];

}

原文地址:https://www.cnblogs.com/zhibin/p/4137401.html