I'm trying to animate the change of an image in a UIImageView using transitionWithVIew
. The image changes, but it doesn't seem to be animating. Not sure why this is happening.
Here's my code:
func changeBackgroundAtIndex(index : Int) {
switch index {
case 0:
animateChangeWithImage(MLStyleKit.imageOfAboutMe)
case 1:
animateChangeWithImage(MLStyleKit.imageOfProjects)
case 2:
animateChangeWithImage(MLStyleKit.imageOfSkills)
case 3:
animateChangeWithImage(MLStyleKit.imageOfEducation)
case 4:
animateChangeWithImage(MLStyleKit.imageOfTheFuture)
default:
animateChangeWithImage(MLStyleKit.imageOfAboutMe)
}
}
func animateChangeWithImage(image : UIImage) {
UIView.transitionWithView(backgroundImageView, duration: 0.4, options: UIViewAnimationOptions.TransitionCrossDissolve, animations: { () -> Void in
self.backgroundImageView.image = image
}, completion: nil)
}
Any ideas? Thanks :)