[英]How to change the callout bubble color in MapView annotation?
I want to be able to display a bluish bubble(default one is black) for callout for an annotation. 我希望能够显示蓝色气泡(默认为黑色),以用于注释的标注。
Wherever I search I only get samples to implement viewForAnnotation delegate method, but that only changes the annotationView not the bubble at the top. 无论在何处搜索,我都只会获得实现viewForAnnotation委托方法的示例,但这只会更改注释视图,而不会更改顶部的气泡。
However I wanted the pinColor to be green so I did override this method and here is the code. 但是我希望pinColor为绿色,所以我确实重写了此方法,这是代码。 Can I do something else to provide a backgroundImage for callOut or change the tintColor for it ?
我可以做些其他事情来为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;
}
Here is how it looks right now: 现在是这样的:
Here is how I want to make it look like: 这是我要使其看起来像的样子:
在iOS7上,您可以使用mapView上的tintColor属性更改披露按钮的颜色。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.