簡單的一個 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];
}
此次分享結束,若有不同想法盡可留言,共進步,也使其更加強大!