Question: I am trying to capture tap event on my `MKMapView`, this way I can drop a `MKPinAnnotation` on the point where user tapped. Basically I have a map overlayed with `MKOverlayViews` (an overlay showing a building) and I would like to give user more information about that Overlay when they tap on it by dropping a `MKPinAnnotaion` and showing more information in the callout.
Thank you.

Answer: 
You can use a `UIGestureRecognizer` to detect touches on the map view.

Instead of a single tap, however, I would suggest looking for a double tap (`UITapGestureRecognizer`) or a long press (`UILongPressGestureRecognizer`). A single tap might interfere with the user trying to single tap on the pin or callout itself.

In the place where you setup the map view (in `viewDidLoad` for example), attach the gesture recognizer to the map view:

```
UITapGestureRecognizer *tgr = [[UITapGestureRecognizer alloc] 
    initWithTarget:self action:@selector(handleGesture:)];
tgr.numberOfTapsRequired = 2;
tgr.numberOfTouchesRequired = 1;
[mapView addGestureRecognizer:tgr];
[tgr release];

```

or to use a long press:

```
UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] 
    initWithTarget:self action:@selector(handleGesture:)];
lpgr.minimumPressDuration = 2.0;  //user must press for 2 seconds
[mapView addGestureRecognizer:lpgr];
[lpgr release];

```

In the `handleGesture:` method:

```
- (void)handleGesture:(UIGestureRecognizer *)gestureRecognizer
{
    if (gestureRecognizer.state != UIGestureRecognizerStateEnded)
        return;

    CGPoint touchPoint = [gestureRecognizer locationInView:mapView];
    CLLocationCoordinate2D touchMapCoordinate = 
        [mapView convertPoint:touchPoint toCoordinateFromView:mapView];

    MKPointAnnotation *pa = [[MKPointAnnotation alloc] init];
    pa.coordinate = touchMapCoordinate;
    pa.title = @"Hello";
    [mapView addAnnotation:pa];
    [pa release];
}

```
If you want to use a single click/tap in the map view, here's a snippet of code I'm using. (Cocoa and Swift)

```
let gr = NSClickGestureRecognizer(target: self, action: "createPoint:")
gr.numberOfClicksRequired = 1
gr.delaysPrimaryMouseButtonEvents = false // allows +/- button press
gr.delegate = self
map.addGestureRecognizer(gr)

```

in the gesture delegate method, a simple test to prefer the double-tap gesture …

```
func gestureRecognizer(gestureRecognizer: NSGestureRecognizer, shouldRequireFailureOfGestureRecognizer otherGestureRecognizer: NSGestureRecognizer) -> Bool {
  let other = otherGestureRecognizer as? NSClickGestureRecognizer
  if (other?.numberOfClicksRequired > 1) {
    return true; // allows double click
  }

  return false
}

```

you could also filter the gesture in other delegate methods if you wanted the Map to be in various "states", one of which allowed the single tap/click