bin
bin

Reputation: 1

How to Get Image position in ImageView

I use a full screen imageView to display the image, as follows:

UIImageView*imageView=[[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,480)]
imageView.contentMode=UIViewContentModeScaleAspectFit;
imageView.image=srcImage;

As the srcImage size differs, its position (frame) in the imageView differs, how can I get the position of the image in imageView?

thanks a lot.

Upvotes: 0

Views: 887

Answers (1)

Ole Begemann
Ole Begemann

Reputation: 135550

You have to do the math yourself. Calculate the aspect ratio of your image and compare with the aspect ratio of the image view's bounds.

Upvotes: 1

Related Questions