I have a UIImage
that is much smaller than the UIImageView
I am applying it too, I would like to know how to scale the UIImage
to fit the width of the UIImageView
but keep the width x height ratio of the original small image.
This is what my code looks like pre any sort of scaling
playerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 222.0, self.playerView.frame.size.width-20, 245.0)];
playerImageView.contentMode = UIViewContentModeBottom;
UIImage *placeholderImage = [UIImage imageNamed: @"placeHolderVault.png"];
[playerImageView setImage:placeholderImage];
Use the proper contentMode
.
playerImageView.contentMode = UIViewContentModeScaleAspectFit;
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