OC学习第三方开源库OCiOS OC 学习手册

SDWebImage 下载图片失败 坑 1

2017-01-11  本文已影响84人  柠檬草YF

使用

- (void)sd_setImageWithURL:(NSURL *)url

或者

- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder 

这个方法下载图片,如果下载第一次 失败了,再使用同样的url 调用该方法,也不会进行第二次尝试, 因为 SD会记录 失败的URL ,对它直接进行错误处理,好在 SD 有提供接口 灵活 处理这样的情况,避免这样的情况 是使用

- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options 

options 传SDWebImageRetryFailed
例如

 [imageView sd_setImageWithURL:url placeholderImage:nil options:SDWebImageRetryFailed];

希望对大家有用,别的问题可以评论留言哦

上一篇 下一篇

猜你喜欢

热点阅读