繁体   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