2010-03-10 57 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类,并添加了新的,这将会让你的地图上标注。