问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/8557719/how-to-change-annotation-callout-button-color-in-iphone