Open pdpraful opened 7 years ago
I solved it by using UIWebView.
let webView = UIWebView(frame: CGRect(x: 0, y: 0, width: Design.screenWidth, height: Design.screenWidth))
webView.isUserInteractionEnabled = false
webView.backgroundColor = .clear
webView.isOpaque = false
webView.load(data, mimeType: "image/gif", textEncodingName: "utf-8", baseURL: NSURL() as URL)
self.view.addSubview(webView)
If you're using @kyam915 workaround you'll also probably want to set this on the web view, so the gif is contained within the bounds of the view.
webView.scalesPageToFit = true
I am using this library to play gifs. When the duration of gifs is more than 6 seconds, the animation play is delayed to 10 seconds of overhead (i.e total time is 16 seconds to call the loop completion block). I am getting a frame rate of 60FPS from GPU. But, the CPU is high @ >70%.