一组图片,动态播放

UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];

    NSMutableArray *array = [NSMutableArray arrayWithCapacity:1]; //创建数组存放图片

//把图片放在数组中

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

        NSString *string = [NSString stringWithFormat:@"Zombie%d", i + 1];

        NSString *filePath = [[NSBundle mainBundle] pathForResource:string ofType:@"tiff"];

        UIImage *image = [UIImage imageWithContentsOfFile:filePath];

        [array addObject:image];

    }

    imageV.animationImages = array;

    imageV.animationDuration = 1; //播放时间

    [imageV startAnimating]; //手动开始播放

    [self.view addSubview:imageV];

    [imageV release];

posted @ 2016-01-25 19:48  侯文超  阅读(171)  评论(0编辑  收藏  举报