This is going to take a little bit of math. There are two properties (both CGPoint
s) that are of importance to you:
- The
frame.origin
of your image, which is its position within its superview
- The
contentOffset
of the scroll view, which is the visible portion of the scroll view
Basically what you want to do is grab the frame.origin.x
and frame.origin.y
properties of the image view, which will tell you where the image is relative to the absolute origin of the scroll view. Then, get the contentOffset.x
and contentOffset.y
of the scroll view and subtract them from the x
and y
of the image view. That should provide you the relative origin of the image view to your screen.