簡體   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