Location Specification with an iOS MapView
Using an iOS device, I am interested in tapping a mapview and getting back the lat / long coordinates of that spot. Is this pos开发者_C百科sible?
You can get the CLLocationCoordinate2D
using convertPoint:toCoordinateFromView
method of the MKMapView
.
CLLocationCoordinate2D coordinate = [self.mapView convertPoint:[gesture locationInView:self.mapView] toCoordinateFromView:self.mapView];
I put this in a tap gesture handler to work. But if you are using some other mechanism to get the touch point, you can use the touch point as the argument passed in convertPoint:
.
精彩评论