简体   繁体   English

如何在iPhone中更改注释标注按钮的颜色?

[英]How to change annotation callout button color in iphone?

在此处输入图片说明

I want to change the above blue color callout button to gray. 我想将上述蓝色标注按钮更改为灰色。 How to do this?? 这个怎么做?? Also is this possible to make whole annotation bubble clickable??? 这也可能使整个注释气泡可点击吗??? Can anyone suggest me the method. 谁能建议我这种方法。

You are probably adding the blue button something like this 您可能正在添加蓝色按钮,如下所示

- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{
MKPinAnnotationView *annView=(MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"annViewIdentifier"];

    if (annView == nil) {
        annView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"annViewIdentifier"] autorelease];
    }
UIButton *infoDefaultButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];

        [infoDefaultButton addTarget:self
                       action:@selector(showDetails:)
             forControlEvents:UIControlEventTouchUpInside];
        annView.rightCalloutAccessoryView = infoDefaultButton;

}

if you want any custom button, then you can add UIButtonTypeCustom instead of UIButtonTypeDetailDisclosure and set its frame. 如果需要任何自定义按钮,则可以添加UIButtonTypeCustom而不是UIButtonTypeDetailDisclosure并设置其框架。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM