Created
February 3, 2015 23:18
-
-
Save licvido/bc22343cacfa3a8ccf88 to your computer and use it in GitHub Desktop.
SWIFT: Fade when changing UIImageView's image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let toImage = UIImage(named:"image.png") | |
UIView.transitionWithView(self.imageView, | |
duration:5, | |
options: .TransitionCrossDissolve, | |
animations: { self.imageView.image = toImage }, | |
completion: nil) |
Very nice , but it should get an upgrade for swift3
Swift 3:
let toImage = UIImage(named:"image.png")
UIView.transition(with: self.imageView,
duration:5,
options: .transitionCrossDissolve,
animations: { self.imageView.image = toImage },
completion: nil)
Thanks, it works perfectly!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
great and easy solution, thank you!