B.S.
B.S.

Reputation: 21726

How to know the size of image in UIImageView

I have imageView with some frame

imageView.frame = CGRectMake(0,0, 100, 100);
imageView.contentMode = UIViewContentModeScaleAspectFit;

imageView.image = myImage;

The question is :

Is there any property or method in imageview to know the result size of the image after it's resizing (something like this : imageView.image.size)

(or should i calculate it myself using image size before and imageview frame)?

Upvotes: 0

Views: 442

Answers (1)

DarkDust
DarkDust

Reputation: 92306

There's no way to query the size of the scaled image, you have to calculate it yourself using the image size and the size constraints.

Upvotes: 2

Related Questions