iOS 简单动画 序列帧动画

时间:2023-03-10 03:22:24
iOS 简单动画 序列帧动画
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{

    NSLog(@"旭宝爱吃鱼");

    UIImageView * imageView = [[UIImageView alloc]init];

    NSMutableArray * animationArray = [NSMutableArray array];

    for (NSInteger i = ; i < ; i ++) {
[animationArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"animation_%02ld.jpg",(long)i]]];
}
//设置动画数组
[imageView setAnimationImages:animationArray];
//设置动画播放次数
[imageView setAnimationRepeatCount:];
//设置动画播放时间
[imageView setAnimationDuration:*0.075];
//开始动画
[imageView startAnimating];
//动画播放完成后,清空动画数组
[imageView performSelector:@selector(setAnimationImages:) withObject:nil afterDelay:imageView.animationDuration];
}