2

我尝试了几件事,但无法解决。

根据可见区域,我在地图上有 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];

但没有运气:(

还有其他方法可以解决我的问题吗??

4

1 回答 1

0

它可能会帮助你。

 NSArray *selectedAnnotations = mapView.selectedAnnotations;
for(id annotationView in selectedAnnotations) {
    [mapView deselectAnnotation:[annotationView annotation] animated:NO];
}
于 2011-07-12T12:44:03.757 回答