Reputation: 834
I have a UIImageView. and i am setting a UIImage to this UIImageView with content mode as UIContentModeScaleAspectFit. Can i know the scale in which the UIImage is resizing when using UIContentModeScaleAspectFit.
Upvotes: 0
Views: 472
Reputation: 38475
Yes, but not automatically :)
The scale will be something like
CGFloat widthScale = imageView.bounds.size.width / image.size.width;
CGFloat heightScale = imageView.bounds.size.height / image.size.height;
You will have to use the correct one depending on if the image has fitted vertically or horizontally ;)
Upvotes: 2