I am using this solution : SO . Where i am loading the gif from the url. My code look like below :
@IBOutlet weak var imageView: UIImageView!
var imageList: [String] = ["http://www.gifbin.com/bin/4802swswsw04.gif", "http://www.gifbin.com/bin/4802swswsw04.gif"]
let imageURL = UIImage.gifImageWithURL(imageList[0])
imageView.image = UIImageView(image: imageURL)
And i am using this This link for gif support as mentioned in that SO. But i am getting error Cannot assign value of type 'UIImageView' to type 'UIImage?
. Yes i understood. But how can i fix this and i tried to fix with UIImage but image gif was not showing.
Any solution would be helpful.
I tried even :
imageView.image = UIImage.gifImageWithURL(imageList[currentnImageIndex])
But image was not showing.
Take a look at the error: Cannot assign value of type 'UIImageView' to type 'UIImage?
You're creating an ImageView and then setting it to the .image, so you probably just need to change:
gifImageView.image = UIImageView(image: imageURL)
to
gifImageView = UIImageView(image: imageURL)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.