2011-08-23 152 views
0

问题我将所有注释添加到单独的数组中。当我尝试使用下面的代码删除已添加到的MapView注释:从mapView中删除注释

if(![newClusters containsObject:cluster]){ 
    [__mapView removeAnnotations:[__clusterAnnotations objectAtIndex:[__clusters indexOfObject:cluster]]]; 
    [__clusterAnnotations removeObjectAtIndex:[__clusters indexOfObject:cluster]]; 
    [__clusters removeObject:cluster]; 
} 

我得到以下错误:

-[ClusterAnnotationClass countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 

我不知道这意味着什么,我可以添加任何注释就好了。它从mapView中移除时崩溃。

任何帮助,将不胜感激。

回答

0

你打电话给removeAnnotations(复数)它需要一个注释数组,但它看起来像你传递它的对象不是一个数组。

也许你打算打电话给removeAnnotation(单数)?

+0

这是我的问题。感谢您的支持。 – Alex