IOS解析动态GIF图的方法

  1. 利用SDWebimage第三方框架;

  2. 工程中导入UIImage+GIF.h

#import "UIImage+GIF.h"

@interface ViewController ()

@property (nonatomic,strong) UIImageView *loadimageView;

@end

#define URLQ @"http://img4.duitang.com/uploads/item/201411/12/20141112224456_xyc4P.thumb.700_0.gif"

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
       
    NSURL *url = [NSURL URLWithString:URLQ];
    
    NSData *imageData = [NSData dataWithContentsOfURL:url];
    
    _loadimageView = [[UIImageView alloc]initWithFrame:CGRectMake(50, 100, 250, 250)];
    
    _loadimageView.image = [UIImage sd_animatedGIFWithData:imageData];
    
    [self.view addSubview:_loadimageView];
  
}

@end


你可能感兴趣的:(+,uiimage,GIF.h,IOS解析GIF,IOS解析动态图)