I will try with this code, but not work
let contentMode: UIView.ContentMode = imageView.contentMode == .scaleAspectFill ?
.scaleAspectFit : .scaleAspectFill
UIView.animate(withDuration: 0.5) {
self.imageView.contentMode = contentMode
}
I will try with this code, but not work
let contentMode: UIView.ContentMode = imageView.contentMode == .scaleAspectFill ?
.scaleAspectFit : .scaleAspectFill
UIView.animate(withDuration: 0.5) {
self.imageView.contentMode = contentMode
}
3
Answers
I'm done this with help of transition
You can’t do it. This is not an animatable property. It is unclear what kind of animation would even make sense.
An alternative would be to substitute a second image view with a different content mode, and cross-dissolve from one image view to the other (transformation).
Why don’t you just animate UIImageView itself? The code below is an example for growing animation.