簡體   English   中英

通過 iPhone 中的代碼顯示 map 標注

[英]show map callout through code in iPhone

我嘗試了幾件事,但無法解決。

我在 map 上有 10 個自定義注釋,具體取決於可見區域。

現在我有 2 個按鈕下一個和上一個。 單擊必須顯示注釋的標注。

即,如果我單擊下一個按鈕,則會出現注釋 1 的標注,當我再次單擊下一步時,第一個的標注將隱藏,而第二個的標注將出現。

我試過了

[self.mapView selectAnnotation:self.nextSelectedAnnotationView.annotation animated:YES]

[self.mapView deselectAnnotation:self.selectedAnnotationView.annotation animated:YES];

但主要問題是如何在這里獲取注釋?

我試過NSArray* selectedAnnotations=self.mapview.annotations來獲取注釋數組

id annotationView =[selectedAnnotations objectAtIndex:i];
[self.mapView selectAnnotation:annotationView animated:YES];

但沒有運氣:(

還有其他方法可以解決我的問題嗎??

它可能會幫助你。

 NSArray *selectedAnnotations = mapView.selectedAnnotations;
for(id annotationView in selectedAnnotations) {
    [mapView deselectAnnotation:[annotationView annotation] animated:NO];
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM