- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
    NSLog(@"旭宝爱吃鱼");
    
    UIImageView * imageView = [[UIImageView alloc]init];
    
    NSMutableArray * animationArray = [NSMutableArray array];
    
    for (NSInteger i = 0; i < 3; i ++) {
            [animationArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"animation_%02ld.jpg",(long)i]]];
    }
    //设置动画数组
    [imageView setAnimationImages:animationArray];
    //设置动画播放次数
    [imageView setAnimationRepeatCount:1];
    //设置动画播放时间
    [imageView setAnimationDuration:3*0.075];
    //开始动画
    [imageView startAnimating];
    //动画播放完成后,清空动画数组
    [imageView performSelector:@selector(setAnimationImages:) withObject:nil afterDelay:imageView.animationDuration];
}

 

相关文章:

  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2022-03-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-30
  • 2022-01-08
  • 2021-10-29
  • 2022-01-23
  • 2022-12-23
相关资源
相似解决方案