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

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

问题描述

我想要一个适用于 iOS 的图像加载和缓存库

I want an image loading and caching library for iOS that

  • 异步加载图像,
  • 缓存图像,具有可配置的缓存大小和 LRU 行为,
  • 使用 HTTP HEAD 检查图像是否已更新,
  • 在出现错误代码或无效图像时不缓存任何内容.

我看过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天全站免登陆