1

誰かが1つのことを手伝ってくれるかどうか興味があります:

「addAnnotation」ピンと「newAnnotation」ピンの両方がマップ上に同時に存在する場合は、最初の「newAnnotation」ピンを削除するようにXcodeに伝えようとしています。

私の機能しないコードは以下のとおりです。

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 に答える