3

I want image coordinates in Uiimageview not UIImageview coordinates.

Because if i have a landscape mode image and i set the property of UIImageview contentmode aspectfit, It will show in portrait mode with white spaces and centered.

Please tell me how to get the x,y coordinate of images in UIImageView.

Thanks

Lukas Kukacka
  • 7,604
  • 2
  • 25
  • 50
Nehaa Saxena
  • 133
  • 1
  • 13

2 Answers2

-1

UIImage does not have a frame,Frame is for UIImageview

Lithu T.V
  • 19,955
  • 12
  • 56
  • 101
-1

Try to create a UIImage from your image data or file, then use the size property to get a CGSize structure representing the image's dimensions. See Apple reference doc.

Hope this helps you!

pankaj asudani
  • 862
  • 6
  • 18
  • It only returns width and height – Nehaa Saxena May 24 '13 at 11:08
  • Did you see apple reference doc, there is no method or attribute to get x or y coordinates.The `UIImage` doesnot have `img.frame.origin.x;`. So you can't do it. – pankaj asudani May 24 '13 at 11:12
  • Yes I've seen that doc before. My problem is I've two images, one covers the whole view and other one overlay the first image. but when I changed the orientation the overlay which is actually on that image shows on the white space.. and the overlay image is movable(drag able). I want that if I'm changing an orientation the overlay shows at the same location where it shows in last orientation. Thanks – Nehaa Saxena May 24 '13 at 11:19