将 Gif 转换为动画 UIImage 时,每帧的延迟都是从属性中提取的,kCGImagePropertyGIFDelayTime
或者kCGImagePropertyGIFUnclampedDelayTime
像这样:
NSString *frameKeyPath = [NSString stringWithFormat:@"%@.%@",(NSString*)kCGImagePropertyGIFDictionary,kCGImagePropertyGIFUnclampedDelayTime];
CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source,i,nil);
NSDictionary *frameProperties = (__bridge NSDictionary*)cfFrameProperties;
NSNumber *delayTimeProp = [frameProperties valueForKeyPath:frameKeyPath];
Chrome 在两种示例情况下都选择了正确的一种:
kCGImagePropertyGIFDelayTime
= 0.1:http: //i.imgur.com/tX9cjUO.gif
kCGImagePropertyGIFUnclampedDelayTime
= 0.01:http: //i.minus.com/iIOyK7SKp8TYc.gif
为每种情况选择一个会导致其中一个示例图像的动画太慢或太快
有没有办法确定使用哪个属性?
谢谢