2010-03-10 59 views
0

我有與它的引腳一個MapView,併爲CLLocation和getDistance的我之間的下面的代碼,並在地圖上的另一點:刷新我的MapView

- (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]; 
} 

,但我如何可以實現刷新地圖的方法當我選擇一個按鈕? ,當我想要的時候,我總能得到我身邊的針腳。 該按鈕不是問題,只有刷新!

我希望有人能幫助我?

問候 馬爾科

+0

沒有人有答案嗎? – Marco 2010-03-10 12:28:31

回答

2

據我知道有沒有這樣的事情removeAllAnnotations,至少在iOS4的SDK ......雖然你可以使用

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

一樣快速修復它也適用於覆蓋

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

到目前爲止,我發現它是最好的方式。

0

只是removeAllAnnotations您MapView類,並添加了新的,這將會讓你的地圖上標註。