I\'m trying to figure out how to put an annotation on a map based on where the user touches.
I have tried sub-classing the MKMapView and looked for the
so i found a way to do it, finally. If i create a view and add a map object to it with the same frame. then listen for hit test on that view, i can call convertPoint:toCoordinateFromView: on the touch point sent, and give it the map like so:
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
CLLocationCoordinate2D coord= [map convertPoint:point toCoordinateFromView:map];
NSLog(@"lat %f",coord.latitude);
NSLog(@"long %f",coord.longitude);
... add annotation ...
return [super hitTest:point withEvent:event];
}
this is pretty rough as is and as you scroll the map it still constantly calls hit test so you will need to handle that, but its a start at getting the gps coordinates from touching a map.