OGeek|极客世界-中国程序员成长平台

标题: ios - 如何更改 MapView 注释中的标注气泡颜色? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 03:05
标题: ios - 如何更改 MapView 注释中的标注气泡颜色?

我希望能够显示一个蓝色气泡(默认为黑色)用于标注标注。

无论我在哪里搜索,我只获得示例来实现 viewForAnnotation 委托(delegate)方法,但这只会更改 annotationView 而不是顶部的气泡。

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

-(MKAnnotationView *)mapViewMKMapView *)mapView viewForAnnotationid<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



Best Answer-推荐答案


在 iOS7 上,您可以使用 mapView 上的 tintColor 属性来更改显示按钮的颜色。

关于ios - 如何更改 MapView 注释中的标注气泡颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17570482/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4