【问题标题】:Using Almofireimage to download and then cache cell image使用 Almofireimage 下载然后缓存单元格图像
【发布时间】:2017-06-22 15:25:52
【问题描述】:

我目前正在使用Alamofireimage 下载图像,我的目标是在完成后缓存它们。由于图片是静态的,一旦下载完毕,就不需要再次下载了。

Alamofireimage 文档说,当使用简单的 UIImageView 扩展名和 af_setImage 时,图像会自动缓存。我的目标是(我在文档中找不到)是如何访问此缓存,然后将其永久缓存到应用程序中。

【问题讨论】:

    标签: ios swift alamofire alamofireimage


    【解决方案1】:

    从这里的文档第 175 行 https://github.com/Alamofire/AlamofireImage/blob/master/Source/UIImageView%2BAlamofireImage.swift

    此方法af_setImage 将自动查找并加载您已缓存的图像。 在此页面中,您可以查看第 280 行以手动访问缓存。

    【讨论】:

    • 这是完美的。感谢您指出允许这样做的来源和行号!
    猜你喜欢
    • 2015-10-08
    • 2023-03-20
    • 2016-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多