私のMapViewを更新
-
19-09-2019 - |
質問
私はその上にピンとの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
と新しいものを追加し、これはあなたの地図上の注釈を更新します。
所属していません StackOverflow