繁体   English   中英

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

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

在此处输入图片说明

我想将上述蓝色标注按钮更改为灰色。 这个怎么做?? 这也可能使整个注释气泡可点击吗??? 谁能建议我这种方法。

您可能正在添加蓝色按钮,如下所示

- (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;

}

如果需要任何自定义按钮,则可以添加UIButtonTypeCustom而不是UIButtonTypeDetailDisclosure并设置其框架。

暂无
暂无

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

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