首页 > 代码库 > UIImage播放序列帧

UIImage播放序列帧

NSMutableArray *images = [NSMutableArray array];

    for (int i = 0; i<count ; i ++) {

        NSString *imageName = [NSString stringWithFormat:@"%@_%02d.jpg",action,i];

        NSString *path = [[NSBundle mainBundle] pathForResource:imageName ofType:nil];

        // NSLog(@"path=%@",path);

        // UIImage *image = [UIImage imageNamed:imageName];  // 有缓存

        UIImage *image = [[UIImage alloc] initWithContentsOfFile:path];  // 没有缓存

        [images addObject:image];

    }

    _tom.animationImages = images;

    _tom.animationDuration = 10 ;

 _tom.animationRepeatCount = 1;

    [_tom startAnimating];  

UIImage播放序列帧