views:

1320

answers:

3

How do I detect a single tap on an instance of MKMapView? Do I have to subclass MKMapView and then override the touchesEnded method?

Thanks,

-Chris

+1  A: 

You cant at this time intercept touches on a map view, you can try layering an opaque view on there and see if it picks up touches...

Daniel
+1  A: 

Or depending on what you are trying to do, add an MKAnnotation (push pin, with a callout), so you have something to tap on - and then your map delegate will receive an event eg.

mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control

TimM
+1  A: 

Hope this will help : How to intercept touches events on a MKMapView or UIWebView objects?

tt.Kilew
This helped, but has issues. But it's better than nothing...
bentford
Yes, if you read in the comments there is another solution. There is actually a third way of doing this (besides sub-classing MKMapView or layering your own view on top and passing on the touches to MKMapView). Instead of subclassing MKMapView, subclass the main window and pass the touch events to both MKMapView and your view. http://stackoverflow.com/questions/1121889/intercepting-hijacking-iphone-touch-events-for-mkmapview/1298330 Haven't tried this yet but apparently performance is better and pinch to zoom still works.
ChrisJF