I have a *.gif file that I want to show in a UIImageView
. I have tried the library FLAnimatedImage, code below. Result is just a static image.
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
}
}
Open to any alternative ways to show animating gif directly from a gif file. I am using Swift.
In my case i'm using
SDWebImage
for manage all image in app. Inclusive havesd_animatedGIFNamed
funcinstall
pod 'SDWebImage'
Create a view controller as shown in the code above. Note:- while creating an imageview in story board, set the class of image view as FLanimatedImageView.
It will work.
Here Loader.gif is the GIF image.
I strongly recommend you to use SwiftGif.
Import the
Gif.swift
in your project and do the following: