I am trying to add some images to my UIImageView. Everything works fine if the png has the same size as the ImageView.
But when I insert a bigger image, it is not discarded.
This is my code:
@IBOutlet weak var PictureView: UIImageView!
func loadSomePicture() {
var examplePicture = UIImage(named: "Block.png")
PictureView.image = exampleProfilePicture
PictureView.layer.cornerRadius = 50
PictureView.clipsToBounds = true
Althoug the clipsToBounds property is set true and the View Mode is Scale to fill, the image stays in its original size.
Thanks for Your help!
check Clip Subviews in Drawing options
I believe the problem is occurring because you are setting the contentMode to "Aspect Fill", instead of "Scale To Fill". Can you maybe explain a little more what you want the ImageView and Image to end up as? "Aspect Fill" will always try and keep the image's aspect ratio while filling it to the ImageView's size dimensions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With