问题
How can I get the location coordinates in mkmapview according to user touching a location on the map on their iphone?
回答1:
Add TapGesture to you mapview and follow below code
-(void)didTouchMap:(UITapGestureRecognizer*)tapGesure {
CGPoint touchPoint = [tapGesure locationInView:selectLocationMapView];
CLLocationCoordinate2D coord= [selectLocationMapView convertPoint:touchPoint toCoordinateFromView:selectLocationMapView];
NSLog(@"lat %f",coord.latitude);
NSLog(@"long %f",coord.longitude);
}
来源:https://stackoverflow.com/questions/6449949/getting-current-location-of-map-on-touch-in-iphone-mkmapview