ios - 当我更新翠鸟时,本地 gif 没有显示
问题描述
我将 Kingfisher 从 4.10 更新到 5.7,但是,gif 没有使用相同的代码显示在 imageView 上。
这是我的代码:
let path = Bundle.main.path(forResource: "loading", ofType: "gif")!
let resource = ImageResource(downloadURL: URL(fileURLWithPath: path))
imageView.kf.setImage(with: resource)
它适用于 Kingfiser 4.10。
解决方案
Kingfisher 库具有本地图像提供程序,必须用于加载本地图像。
所以你的代码应该改成这样:
let path = Bundle.main.url(forResource: "loading", withExtension: "gif")!
let resource = LocalFileImageDataProvider(fileURL: path)
imageView.kf.setImage(with: resource)
推荐阅读
- python - Pandas:如何在 GROUPBY 之后使用 MELT
- python - 数据类对象属性别名
- python - 在 Python 中使用 opencv 加速自定义自适应平滑滤波器
- javascript - 开玩笑:从自己的包导入时无法读取未定义的属性
- javascript - 符合 ES6 标准的 JavaScript 代码优化
- html - HTML - 文本位置,如平方数
- hive - 表或数据库名称不得包含点 (.) 字符
- php - Arduino 无法将数据发布到 PHP
- javascript - d3 v6 围绕中心而不是光标缩放
- postgresql - Postgresql 驱动程序声称在将环境传递给 DOCKER 的应用程序属性时不接受 JDBC URL