2011-08-23 157 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