从 MapView 中删除多个注释
在我的应用程序中,当我的表视图加载时,我有两个功能,在地图视图中,所有引脚都显示与 tableData 相对应。现在我有搜索栏,它提供了我必须在地图视图上显示的另一组值。一切都工作正常,但第二还显示以前的引脚意味着以前的注释未被删除。 所以请告诉我如何删除以前的注释,以便我可以在地图视图上仅显示相关的引脚 提前致谢
In my app I have two functionality when my tableview loads ,in the mapview all the pins are shown corresponding to tableData.NOw I have search bar which gives another set of values which I have to show on my mapView.Everything is working fine but second time previous pins are also shown means prevoius annotations are not deleted .
So please tell me how to remove prevoius annotation so that I can show only relavent pins on mapView
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需使用 MKMapView 实例方法“removeAnnotations:”:
http:// developer.apple.com/library/ios/#documentation/MapKit/Reference/MKMapView_Class/MKMapView/MKMapView.html
如果您想删除所有这些,您可以执行以下操作:
PS:请注意,您可能想要迭代注释而不是删除 userLocation (蓝点)
希望这有帮助,
文森特
Simply use the MKMapView instance method "removeAnnotations:":
http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKMapView_Class/MKMapView/MKMapView.html
If you want to remove all of them you can do somethign like :
P.S: Beware that you might want to iterate through the annotations not to remove the userLocation (blue dot)
Hope this helps,
Vincent
我自己得到了答案:-mapAddAnnotations
是我的数组名称,map 是我的 mkmapview 对象。
I got my answer my self:-
mapAddAnnotations is my arrayname and map is my mkmapview object.