简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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