本文介绍了MKAnnotationView始终显示infoButton而不是detailDisclosure btn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道为什么我不能强制mapView标注使用detailDisclosureBtn而不是infoButton?

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;
}

这是我对委托的实施。

推荐答案

detailDisclosure类型和infoLight / infoDark的按钮图像是相同的。

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

这篇关于MKAnnotationView始终显示infoButton而不是detailDisclosure btn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 22:50