删除第一个注释-MapView iOS [英] Removing First Annotation-MapView iOS

查看:123
本文介绍了删除第一个注释-MapView iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发mapview项目。我有关于从mapView中删除注释的问题。
我已经实现了以下代码,但它随机删除了注释,而不是第一个!

I am working on mapview project. I have question related to removing annotation from the mapView. I have implemented the following code but it removes annotation randomly, not the first one!

[mapView removeAnnotation:[self.mapView.annotations objectAtIndex:0]];


推荐答案

self.mapView.annotations 为您提供了所有注释的NSArray,但它不保证每次都按照相同的顺序,也不按照添加注释的顺序。你必须找到另一种方法来获得你想删除的那个。

self.mapView.annotations gives you an NSArray of all the annotations, but it does not promise to be in the same order each time nor in the order you added annotations. You will have to find another way to get a reference to the one you intend to delete.

这篇关于删除第一个注释-MapView iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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