MKAnnotationView always shows infoButton instead o

2019-01-28 05:21发布

问题:

has somebody an idea why i can't force the mapView callout to use a detailDisclosureBtn instead of infoButton?

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
    static NSString *identifier = @"HPIPAnnotation";

    if ([annotation isKindOfClass:[CoreCityAnnotation class]])
    {
        MKPinAnnotationView *annotationView = (MKPinAnnotationView *) [_mapView dequeueReusableAnnotationViewWithIdentifier:identifier];
        if (annotationView == nil) {
            annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
        } else {
            annotationView.annotation = annotation;
        }

        UIButton *disclosureButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];

        annotationView.canShowCallout = YES;
        annotationView.animatesDrop = YES;

        annotationView.rightCalloutAccessoryView = disclosureButton;

    return annotationView;

    }

    return nil;
}

Thats my implementation of the delegate.

回答1:

The button images for detailDisclosure type and infoLight/infoDark are the same.

https://developer.apple.com/library/ios/documentation/userexperience/conceptual/mobilehig/Controls.html#//apple_ref/doc/uid/TP40006556-CH15-SW4