Search code examples
objective-cmkmapviewcgrect

Convert distance on UIView to distance for MKMapView


Basically, I'm trying to to the opposite of Convert distance on MKMapView to distance for UIView.

I have a distance in UI View, and want to convert it to a distance of MK-MapView.


Solution

  • Why not just go to the documentation? You clearly haven't in this case.

    If you had you would have found the method...

    - (MKCoordinateRegion)convertRect:(CGRect)rect
                     toRegionFromView:(UIView *)view
    

    Which is the one after the method in the linked question.

    So just reverse the process from the linked question using this method.

    Documentation for MKMapView

    BTW, to find the documentation for any class just put the class name into Google. The first link (most of the time) will be a link to the Apple documentation.