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 have sd_animatedGIFNamed
func
install pod 'SDWebImage'
I strongly recommend you to use SwiftGif.
Import the Gif.swift
in your project and do the following:
// Returns an animated UIImage
let jeremyGif = UIImage.gifWithName("jeremy")
// Use the UIImage in your UIImageView
let imageView = UIImageView(image: jeremyGif)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With