通过iPhone code显示地图标注 [英] show map callout through code in iPhone

查看:238
本文介绍了通过iPhone code显示地图标注的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经试过几件事,但我无法解决它。

I have tried several things but am unable to solve it out.

我也取决于该地区的地图上10个自定义注释可见。

I have 10 custom annotations on the map depending upon the area visible.

现在我有2个按钮旁边和previous。点击它必须得到注释显示的标注。

Now I have 2 buttons next and previous. Clicking on which the callout of annotation must get displayed.

即,如果我下次布顿则点击注释1的标注将会出现,当我下一次再次单击则先的标注将隐藏和第二的标注将会出现。

i.e if i click on next buton then callout of annotation 1 will appear and when i click next again then the callout of first will hide and callout of second will appear.

我已经尝试了

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

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

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

But the main problem is how to get the annotation here??

我曾尝试的NSArray * selectedAnnotations = self.mapview.annotations 来获得批注阵列

I have tried NSArray* selectedAnnotations=self.mapview.annotations to get the annotations array

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

但没有运气:(

任何其他方式来解决我的问题。??

Any other way to solve my issue.??

推荐答案

它可以帮助你。

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

这篇关于通过iPhone code显示地图标注的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆