MKAnnotationView始终显示infoButton而不是detailDisclosure btn [英] MKAnnotationView always shows infoButton instead of detailDisclosure btn

查看:91
本文介绍了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.

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

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆