6 jun
2017

UIImageView scaleAspectFill content mode is not working within a scroll view

I have a UIImageView that I have configured like this:

imageView.contentMode = .scaleAspectFill
imageView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)

and later:

scrollView.addSubview(imageView)

My scrollView size and contentSize is the full screen.

when I set the image of the imageView, I always see the image in its original size. I have changed to another content mode to test, but it looks like it is ignored and the image is always displayed in its original size.

I suppose it is something related to being adding the image view to a scroll view, how could I solve this?

COMENTARIOS

DEJA TU COMENTARIO

© 2017 website by Rubit Corporation