如何在iPhone中更改注释标注按钮的颜色? [英] How to change annotation callout button color in iphone?

查看:146
本文介绍了如何在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;

}

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

if you want any custom button, then you can add UIButtonTypeCustom instead of UIButtonTypeDetailDisclosure and set its frame.

这篇关于如何在iPhone中更改注释标注按钮的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆