我有在其上销一个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];
}

但如何可以实现刷新地图时,我标签上的按钮的方法? 我总是让我周围的脚时,我想。 按钮是没有问题的,只刷新!

我希望有人能帮助我吗?

问候 马可

有帮助吗?

解决方案

据我知道有没有这样的事情removeAllAnnotations,iOS4的SDK至少不会......虽然你可以使用快速解决问题。

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

同样适用于覆盖

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

到目前为止我发现做到这一点的最好办法。

其他提示

只是removeAllAnnotations您MapView类,并添加了新的,这将刷新你的地图上注释。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top