iOS - 异步缓存和加载图像 [英] iOS - Caching and loading images asynchronously

查看:167
本文介绍了iOS - 异步缓存和加载图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要iOS的图片加载和缓存库

I want an image loading and caching library for iOS that


  • 异步加载图片,

  • 缓存图像,具有可配置的缓存大小和LRU行为,

  • 使用HTTP HEAD检查图像是否已更新,

  • doesn'如果出现错误代码或图像无效,请缓存任何内容。

  • loads images asynchronously,
  • caches images, with a configurable cache size and LRU behaviour,
  • checks to see if images have been updated, using HTTP HEAD,
  • doesn't cache anything in the event of an error code or an invalid image.

我看过HJCache ,但它只满足前两个标准。还有更好的东西吗?

I've looked at HJCache, but it only satisfies the first two of these criteria. Is there something better?

推荐答案

我知道这个帖子已经被回答,但我已经尝试了一个效果很好的库。我之前使用的是ASIHttpRequest,差别很大。

I know that this thread has been answered, but I have tried a library that has worked great. I was using ASIHttpRequest before and the difference is big.

https:// github。 com / rs / SDWebImage

此外,如果有人需要调整大小或裁剪远程图像,并且具有SDWebImage提供的相同功能,我已经集成了SDWebImage库中有UIImage + Resize库(由Trevor Harmon编写),并创建了一个示例项目。我修改了SDWebImage的代码来处理转换(裁剪,调整大小)。

Also, if someone needs to Resize or Crop the remote images, and have the same features that SDWebImage provide, I have integrated SDWebImage library with UIImage+Resize library (by Trevor Harmon), and created an example project. I modified the code of SDWebImage to deal with transformations (crop, resize).

该项目公开在https://github.com/toptierlabs/ImageCacheResize 。随意使用它!

The project is public on https://github.com/toptierlabs/ImageCacheResize. Feel free to use it!

这篇关于iOS - 异步缓存和加载图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆