0

ピンが付いたmapViewがあり、地図上の別のポイントと私との間のCLLocationとgetDistanceの次のコードがあります。

    - (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation{

 Koordinate *kunde = [[Koordinate alloc] init];
 kundenPoints = [[NSMutableArray array] retain];

 for(int i = 0; i<[eventPoints count]; i++){
  kunde = [eventPoints objectAtIndex:i];
  CLLocation *userLoc = [[CLLocation alloc] initWithLatitude:kunde.latitude longitude:kunde.longtitude];
  double distance = [newLocation getDistanceFrom:userLoc] / 1000;
  if(distance <= 100){
   [kundenPoints addObject:kunde];
  }else {
  }
 }
 [mapView addAnnotations:kundenPoints];
}

しかし、ボタンをタップしたときにマップを更新するメソッドを実装するにはどうすればよいですか? いつでも好きなときにピンを手に入れることができます。ボタンは問題ではなく、リフレッシュのみです!

誰かが私を助けてくれることを願っています??

よろしくマルコ

4

2 に答える 2

2

私の知る限り、少なくともiOS4 SDKには、removeAllAnnotationsのようなものはありません...ただし、

NSArray *ants = [mapView_ annotations];
[mapView_ removeAnnotations:ants];

オーバーレイについても同じです

NSArray *ants = [mapView_ overlays];
[mapView_ removeOverlays:ants];

これまでのところ、私がそれを行うために見つけた最良の方法です。

于 2010-07-06T02:08:02.980 に答える
0

mapViewremoveAllAnnotationsに追加して新しいものを追加するだけで、マップ上の注釈が更新されます。

于 2010-03-10T13:12:30.287 に答える