首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过iPhone中的代码显示地图标注

通过iPhone中的代码显示地图标注
EN

Stack Overflow用户
提问于 2011-07-12 20:26:28
回答 1查看 781关注 0票数 2

我试过几件事,但都不能解决。

我在地图上有10个自定义注释,这取决于可见的区域。

现在我有两个按钮,下一个和上一个。单击必须显示注释的详图索引的位置。

也就是说,如果我点击next buton,那么注释1的标注就会出现,当我再次点击next时,第一个标注就会隐藏,第二个标注就会出现。

我试过了

代码语言:javascript
复制
[self.mapView selectAnnotation:self.nextSelectedAnnotationView.annotation animated:YES]

代码语言:javascript
复制
[self.mapView deselectAnnotation:self.selectedAnnotationView.annotation animated:YES];

但主要的问题是如何在这里获得注释??

我尝试过使用NSArray* selectedAnnotations=self.mapview.annotations来获取注解数组

代码语言:javascript
复制
id annotationView =[selectedAnnotations objectAtIndex:i];
[self.mapView selectAnnotation:annotationView animated:YES];

但是运气不好:

有没有别的办法来解决我的问题??

EN

回答 1

Stack Overflow用户

发布于 2011-07-12 20:44:04

这可能会对你有帮助。

代码语言:javascript
复制
 NSArray *selectedAnnotations = mapView.selectedAnnotations;
for(id annotationView in selectedAnnotations) {
    [mapView deselectAnnotation:[annotationView annotation] animated:NO];
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6664125

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档