更新Kingfisher时未显示本地gif

时间:2019-11-07 10:10:48

标签: ios swift kingfisher

我将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一起很好地工作。

1 个答案:

答案 0 :(得分:1)

Kingfisher库具有local image provider,必须使用它来加载本地图像。

因此您的代码应更改为此:

let path = Bundle.main.url(forResource: "loading", withExtension: "gif")!
let resource = LocalFileImageDataProvider(fileURL: path)
imageView.kf.setImage(with: resource)