質問

私はその上にピンとの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];
}

が、どのように私は、ボタンの上にマップI]タブをリフレッシュする方法を実装することができますか? 私が欲しいとき、私はいつも私の周りのピンを取得していること。 ボタンは問題ではありません、だけでリフレッシュ!

私は

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

よろしく マルコ

役に立ちましたか?

解決

私の知る限りそこremoveAllAnnotationsのようなものは、ありません、少なくともではないiOS4をSDKで...あなたはすぐに使用して、それを修正することができますが、知っているように、

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

オーバーレイに同じになります。

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

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

他のヒント

ちょうどあなたのMapViewにremoveAllAnnotationsと新しいものを追加し、これはあなたの地図上の注釈を更新します。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top