1

好奇是否有人可以帮助做一件事:

我只是想告诉 Xcode,如果地图上同时存在“addAnnotation”和“newAnnotation”引脚,则删除初始的“newAnnotation”引脚。

我的非工作代码如下:

if ([self.mapView addAnnotation:addAnnotation] & [self.mapView addAnnotation:newAnnotation] return)
{
    [self.mapView removeAnnotation:newAnnotation];
}

谢谢!

4

1 回答 1

6

感谢您的反馈,但我解决了这个问题:

NSArray *existingpoints = mapView.annotations;

if ([existingpoints count])
    [mapView removeAnnotations:existingpoints];
于 2012-10-24T23:10:35.253 回答