iOS 判断gif图

来源:互联网 发布:知乎 app交互设计分析 编辑:程序博客网 时间:2024/04/28 03:29
CGImageSourceRef source0 = CGImageSourceCreateWithURL((CFURLRef)[NSURL URLWithString:_item.permalink], NULL);        CFDataRef dataRef = CGDataProviderCopyData(CGImageGetDataProvider(aImage.CGImage));CGImageSourceRef source = CGImageSourceCreateWithData(dataRef, NULL);NSLog(@"source = %@ + %@",source,source0);NSDictionary* properties = (NSDictionary*)CGImageSourceCopyProperties(source, NULL);NSDictionary* gifProperties = [properties objectForKey:(NSString*)kCGImagePropertyGIFDictionary];NSLog(@"properties: %@,gifProperties: %@, source = %@",properties,gifProperties,CGImageSourceGetType(source));if (gifProperties != nil && [@"com.compuserve.gif" isEqualToString:[NSString stringWithFormat:@"%@",CGImageSourceGetType(source)]]) {        _imgGIF = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"GIF.png"]];    [_imgGIF setFrame:CGRectMake(photoIV.frame.size.width - 5.0f - _imgGIF.width, photoIV.frame.size.height - 5.0f - _imgGIF.height, _imgGIF.width, _imgGIF.height)];    [photoIV addSubview:_imgGIF];} else {    _imgGIF = nil;}

0 0
原创粉丝点击