SDImage加载超大尺寸的gif图片,可以在xcode里看到内存爆增几百兆,这个问题网上没找到很好的解决方案。
所以我只好勉为其难的强制修改了sd中渲染gif的尺寸来解决,将gif的大小限制为屏幕的宽高。
实际效果看起来还行,就是手机渲染时,cpu会因为计算CGImageRef的绘制而暂时很高。
CGSize sizefix = CGSizeMake((thumbnailSize.width == 0 ? [UIScreen mainScreen].bounds.size.width : thumbnailSize.width), (thumbnailSize.height == 0 ? [UIScreen mainScreen].bounds.size.height : thumbnailSize.height));
for (size_t i = 0; i < count; i++) {
UIImage *image = [self.class createFrameAtIndex:i source:source scale:scale preserveAspectRatio:preserveAspectRatio thumbnailSize:sizefix options:nil];
if (!image) {
continue;
}