0

I want to avoid to display a callout when I tap a MKAnnotation, just to display the pin, and when I tap, I want nothing happens.

Thanks

Juanjo
  • 929
  • 1
  • 15
  • 29
  • 1
    `pin.canShowCallout = NO;` in `-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id)annotation` – ChintaN -Maddy- Ramani May 21 '14 at 09:24
  • 1
    check this http://stackoverflow.com/questions/1193928/how-to-close-a-callout-for-mkannotation-in-a-mkmapview http://stackoverflow.com/questions/2918154/how-to-hide-mkannotationview-callout – srinivas n May 21 '14 at 09:30

2 Answers2

4

Try like this .

 - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
    MKPinAnnotationView *annView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"sample"];

    annView.canShowCallout = NO;

    return annView;
}

Hope this code is useful for you.

Darshan Kunjadiya
  • 3,323
  • 1
  • 29
  • 31
2

This will help you.

-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
    static NSString *reuseId = @"pin";
    MKPinAnnotationView *pinV = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:reuseId];
    if (pinV == nil)
    {
        pinV = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:reuseId];
        pinV.canShowCallout = NO; // You have to add this.
    }
    return pinV;
}
ChintaN -Maddy- Ramani
  • 5,156
  • 1
  • 27
  • 48