将 image 图片数组生成 gif 格式图片 - iOS

澹台季萌
2023-12-01

简单的一个 demo, 实际开发中可以在此基础上进行修改,更佳贴合实际产品需求.

code 如下:

/**
 将图片 Image 数组生成 gif 格式图片

 @param arrImgName      图片资源
 @param imgViewFrame    控件尺寸(ImageView)
 @param view            当前视图
 */
+ (void)createGifImageWithImageName:(NSArray *)arrImgName AndImageViewFrame:(CGRect)imgViewFrame AndCurrentView:(UIView *)view {
    UIImageView *imgViewAnimated = [[UIImageView alloc] initWithFrame:imgViewFrame];
    imgViewAnimated.animationImages = arrImgName;
    
    imgViewAnimated.animationDuration = 1.f;
    imgViewAnimated.animationRepeatCount = 0;
    
    [view addSubview:imgViewAnimated];
    [imgViewAnimated startAnimating];
}

 

此次分享结束,若有不同想法尽可留言,共进步,也使其更加强大!

 类似资料: