I've added a UITapGestureRecognizer to an MKMapView, like so:
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(doStuff:)];
[tapGesture setCancelsTouchesInView:NO];
[tapGesture setDelaysTouchesEnded:NO];
[[self myMap] addGestureRecognizer:tapGesture];
[tapGesture release];
This almost works: tap gestures are recognized and double taps still zoom the map. Unfortunately, the UITapGestureRecognizer interferes with the selection and deselection of MKAnnotationView elements, which are also triggered by tap gestures.
Setting the setCancelsTouchesInView and setDelaysTouchesEnded properties doesn't have any effect. Annotation selection works fine if I don't add the UIGestureRecognizer.
What am I missing?
UPDATE:
As suggested by Anna Karenina below, this problem can be avoided by returning YES in the shouldRecognizeSimultaneouslyWithGestureRecognizer: delegate method.
More details in this answer.