I created a UIImageView
and assigned it an UIImage
. I set the UIImageView content mode to Aspect Fit
. How do I remove the padding from the top and bottom of the image, or how do I resize the UIImageView
to wrap around the image? I tried everything.
If you are going to say to get the new size of the image, it won't work. Getting the image size inside the UIImageView
only gives the width and height of the original image.
Please do not link other posts. I have read them already. They do not work.
You may calculate it manually for UIImageView's frame sizes that Aspect Fit with your image, or use AVMakeRectWithAspectRatioInsideRect(method from AVFoundation).
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