ios – 无法在swift中的UIImageView中显示* .gif文件
2019年06月25日
作者:佚名
我有一个* .gif文件,我想在UI
ImageView中显示.我已经尝试过库
FLAnimatedImage,代码如下.结果只是一个静态图像.
class LoginVC: UIViewController,UITextFieldDelegate { @IBOutlet weak var img_popup: FLAnimatedImageView! var img_popupraw: FLAnimatedImage = FLAnimatedImage(animatedGIFData: NSData(contentsOfFile: "ShitTalk_LoadingAnimation.gif")) override func viewDidLoad() { img_popup.animatedImage = img_popupraw } }
打开任何其他方法直接从gif文件显示动画gif.我正在使用Swift.
解决方法
我强烈建议你使用
SwiftGif.
在项目中导入Gif.swift并执行以下操作:
// Returns an animated UIImage let jeremyGif = UIImage.gifWithName("jeremy") // Use the UIImage in your UIImageView let imageView = UIImageView(image: jeremyGif)
以上是来客网为你收集整理的ios – 无法在swift中的UIImageView中显示* .gif文件全部内容,希望文章能够帮你解决ios – 无法在swift中的UIImageView中显示* .gif文件所遇到的程序开发问题。
如果觉得来客网网站内容还不错,欢迎将来客网网站推荐给程序员好友。