4

私のマップビューでは、、、、のようなピンを作成しcafebarnight_clubますrestaurantcafeたとえば、特定のポイントのみを削除するようにコーディングするにはどうすればよいですか。以下のコードを使用して、すべての注釈を正常に削除しました。(すべてではなく) 特定の 1 つを削除する方法がわかりません。

for (id<MKAnnotation> annotation in routeMapView.annotations) 
{
  if ([annotation isKindOfClass:[MapPoint class]]) 
  {
    [routeMapView removeAnnotation:index=annotation];
  }
}
4

2 に答える 2

4

参考になるかもしれませんので是非使ってみてください。

for (id annotation in mapView.annotations)
{
    if ([[annotation title] isEqualToString:@"cafe"])
          [self.mapView removeAnnotation:annotation];
}
于 2013-04-30T13:41:15.830 に答える