iosiphonemkmapviewmkmapitem

Remove The Information Button Option From Map Annotation Title


PREAMBLE

I have implemented a map annotation using MKMapView and MapAnnotation. When tapped a title view appears as depicted in the following image.

map annotation title

I have used the following LOC to implement said map annotation:

// VENUE 1 PIN.

CLLocationCoordinate2D venue1Location = CLLocationCoordinate2DMake(-27.5, 153.5);

MapAnnotation *venue1Pin = [[MapAnnotation alloc] initWithTitle:@"1 ONE ST" Location:venue1Location];

VIEW FOR ANNOTATION DELEGATE METHOD:

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
if ([annotation isKindOfClass:[MapAnnotation class]])
{
    MapAnnotation *venueLocationAnnotation = (MapAnnotation *)annotation;

    MKAnnotationView *venueLocationAnnotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:@"customAnnotation"];

    venueLocationAnnotationView.rightCalloutAccessoryView.hidden = YES;

    if (venueLocationAnnotationView == nil)

        venueLocationAnnotationView = venueLocationAnnotation.annotationView;

    else

        venueLocationAnnotationView.annotation = annotation;


        return venueLocationAnnotationView;

}
else
{
    return nil;
}

}

QUESTION

How do I remove the information button from the aforementioned map annotation title view ?


Solution

  • - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
    {
    MKAnnotationView *annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:nil];
    annotationView.canShowCallout = YES;
    
    annotationView.rightCalloutAccessoryView.hidden=YES;
    
    return annotationView;
    }