13
我在我的應用程序地圖頁面中有一個需求。我必須自定義標註泡泡。我需要添加一個圖像,兩個標籤和一個具有特定高度和寬度的按鈕。自定義MKAnnotation標註氣泡
我已經通過網絡,找不到解釋如何自定義標註泡泡的正確鏈接。如果您有任何人遇到或知道它,請與我分享。
任何簡單的例子或鏈接將是非常好的。
在此先感謝 蘇雷什
我在我的應用程序地圖頁面中有一個需求。我必須自定義標註泡泡。我需要添加一個圖像,兩個標籤和一個具有特定高度和寬度的按鈕。自定義MKAnnotation標註氣泡
我已經通過網絡,找不到解釋如何自定義標註泡泡的正確鏈接。如果您有任何人遇到或知道它,請與我分享。
任何簡單的例子或鏈接將是非常好的。
在此先感謝 蘇雷什
一個例子,以幫助您:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
MKAnnotationView *annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"loc"];
// Button
UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
button.frame = CGRectMake(0, 0, 23, 23);
annotationView.rightCalloutAccessoryView = button;
// Image and two labels
UIView *leftCAV = [[UIView alloc] initWithFrame:CGRectMake(0,0,23,23)];
[leftCAV addSubview : yourImageView];
[leftCAV addSubview : yourFirstLabel];
[leftCAV addSubview : yourSecondLabel];
annotationView.leftCalloutAccessoryView = leftCAV;
annotationView.canShowCallout = YES;
return annotationView;
}
的
可能重複[?定製annotationview標註泡]( http://stackoverflow.com/questions/1565828/customize-callout-bubble-for-annotationview) – Anurag 2010-11-04 06:21:41
嗨anurag 該帖子沒有幫助我。因爲在哪裏寫openForAnnotation事件以及當我單擊註釋時如何連接視圖。我不清楚。我正在尋找更詳細的解釋。如果你知道,請... – sbmandav 2010-11-04 06:52:37