如何在af_setImageWithURL完成后将图像放入AutoPurgingImageCache? [英] How to put image into AutoPurgingImageCache after af_setImageWithURL completed?

查看:127
本文介绍了如何在af_setImageWithURL完成后将图像放入AutoPurgingImageCache?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将 imageView.af_setImageWithURL(URL) AutoPurgingImageCache 一起使用/ Alamofire / AlamofireImagerel =nofollow> AlamofireImage

I want to use imageView.af_setImageWithURL(URL) together with the AutoPurgingImageCache from AlamofireImage.

如何通知 af_setImageWithURL 获取图像,所以我可以将它放入缓存中?因为这是在后台完成的。

How can I be informed that af_setImageWithURL fetched the image, so I can put it into my cache? Because this is done in Background.

我更喜欢以下内容: imageView.af_imageFromCache(URL)哪些设置来自缓存的图像(如果它已经在那里或以其他方式下载异步),然后设置图像并将其保存在缓存中。

I'd prefer something like: imageView.af_imageFromCache(URL) which sets the image from cache if it is already in there or otherwise downloads async, then sets the image and saves it in the cache.

推荐答案

UIImageView 使用的共享 ImageDownloader 已经将图像放入 AutoPurgingImageCache 自动。每次使用 imageView.af_setImageWithURL(URL)时,如果图像存在,它将尝试将图像拉出图像缓存。如果图像不在缓存中,它将在 ImageDownloader 实例上开始下载。

The shared ImageDownloader that the UIImageView uses already puts the image into the AutoPurgingImageCache automatically. Every time you use the imageView.af_setImageWithURL(URL) it will attempt to pull the image out of the image cache if it exists. If the image is not already in the cache, it will start the download on the ImageDownloader instance.

这篇关于如何在af_setImageWithURL完成后将图像放入AutoPurgingImageCache?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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