在我的应用程序中,我需要使用 .gif
并且我确实对其进行了搜索。每个人都要求使用 UIImage.gifImageWithName("funny")
或 UIImage.gifWithName("jeremy")
添加 .gif
文件。但是我在那些 Type 'UIImage' has no member 'gifWithName'
上遇到错误。如何解决这些问题以及如何在我的应用中使用 .gif
。
最佳答案
从 https://github.com/bahlo/SwiftGif/tree/master/SwiftGifCommon 下载 UIImage+Gif.swift 文件并放入您的项目中..
// An animated UIImage
let Gif = UIImage.gif(name: "jerry")
// A UIImageView with async loading
let imageView = UIImageView()
imageView.loadGif(name: "tom")]
关于iOS Swift 如何在我的项目中使用 Gif 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43870427/