iosGif动画

iOS GIF分解成uiimageView 播放GIF

2019-06-16  本文已影响0人  何大叔

一、GIF分解成uiimageView

import <ImageIO/ImageIO.h>

import <MobileCoreServices/MobileCoreServices.h>

二播放GIF

NSMutableArray *imageTemp = [NSMutableArray array];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 100, 120, 120)];
[self.view addSubview:imageView];

for (NSInteger index = 0; index < 2; index++) {
    UIImage *image = self.imageSources[index];
    [imageTemp addObject:image];
}

[imageView setAnimationImages:imageTemp];
[imageView setAnimationRepeatCount:MAXFLOAT];
[imageView setAnimationDuration:1];
[imageView startAnimating];

}

上一篇下一篇

猜你喜欢

热点阅读