I'd like to acquire the position (not map coordinates) of the annotation relative to the screen.
For example, for an annotation on the map, I'd like to know how far that particular pin is from the top left corner (0,0).
I've looked at the documentations, and it does not provide information on its absolute or relative location.
I'll look further into the quartz framework before possibly sub-classing and overriding the rendering methods as a last resort.
Any ideas?
Given an MKAnnotation, you can get the MKAnnocationView using [MKMapView viewForAnnoation]
. You can use that to the get the center of the view in window coordinates:
CGPoint windowPoint = [annView convertPoint:[annView center] toView:window]
The main UIWindow is generally available through your AppDelegate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With