How to change annotation callout button color in iphone?

血红的双手。 提交于 2019-12-12 02:16:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!