I\'ve been using SDWebImage on my iPhone app to handle all of the image loading. I am using a placeholder image, and I want to crossfade or fade in the new image once it loads.
SWIFT:
func setSDWebImageWithAnimation(imageViewToSet mImageView:UIImageView, URLToSet imageURL:NSURL!)
{
mImageView.image = UIImage(named: "favouritePlaceholder")
SDWebImageManager.sharedManager().downloadImageWithURL(imageURL, options: nil, progress: nil) { (downloadedImage:UIImage!, error:NSError!, cacheType:SDImageCacheType, isDownloaded:Bool, withURL:NSURL!) -> Void in
mImageView.alpha = 0
UIView.transitionWithView(mImageView, duration: 1.0, options: UIViewAnimationOptions.TransitionCrossDissolve, animations: { () -> Void in
mImageView.image = downloadedImage
mImageView.alpha = 1
}, completion: nil)
}
}