iOS - Установить кнопку раскрытия подробностей в MKAnnotationView

В моем MapViewController есть следующий метод:

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
    MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:@"MapVC"];
    if (!annotationView) {
        annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"MapVC"];
        annotationView.canShowCallout = YES;
        annotationView.leftCalloutAccessoryView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
        annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        // could put a rightCalloutAccessoryView here
    } else {
        annotationView.annotation = annotation;
        [(UIImageView *)annotationView.leftCalloutAccessoryView setImage:nil];
    }

    return annotationView;
} 

Я считаю, что он настроен правильно, но когда моя карта правильно показывает мои аннотации с заголовком и подзаголовком, но они не показывают кнопку раскрытия деталей, я что-то упускаю?

Другое дело, что при отладке этот метод никогда не вызывается, но вид аннотации отображается с заголовком и подзаголовок.

5
задан 8vius 21 February 2012 в 06:34
поделиться