首页 文章

如何更改MapView注释中的标注气泡颜色?

提问于
浏览
2

我希望能够为注释的标注显示蓝色气泡(默认为黑色) .

无论我在哪里搜索,我只获取样本来实现viewForAnnotation委托方法,但这只会更改annotationView而不是顶部的气泡 .

但是我希望pinColor为绿色,所以我确实覆盖了这个方法,这里是代码 . 我可以做其他事情来为callOut提供backgroundImage或为它更改tintColor吗?

-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
    MKPinAnnotationView *annView=[[[MKPinAnnotationView alloc]
                                  initWithAnnotation:annotation reuseIdentifier:@"pin"] autorelease];
    annView.pinColor = MKPinAnnotationColorGreen;
    [annView setEnabled:YES];
    [annView setCanShowCallout:YES];

    return annView;

}

以下是它现在的样子:

enter image description here

这是我想让它看起来像:

enter image description here

2 回答

相关问题