我希望能够为注释的标注显示蓝色气泡(默认为黑色) .
无论我在哪里搜索,我只获取样本来实现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;
}
以下是它现在的样子:
这是我想让它看起来像:
2 回答
您可以使用自定义注释,如http://blog.asynchrony.com/2010/09/building-custom-map-annotation-callouts-part-2/所述
在iOS7上,您可以使用mapView上的tintColor属性来更改公开按钮的颜色 .