내 MapView를 새로 고치십시오
-
19-09-2019 - |
문제
핀이있는지도 뷰가 있고, 나와지도의 다른 지점 사이의 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];
}
그러나 버튼에 탭할 때 맵을 새로 고치는 메소드를 어떻게 구현할 수 있습니까? 내가 원할 때 나는 항상 내 주위에 핀을 얻는다. 버튼은 문제가되지 않고 새로 고침 만 있습니다!
누군가 나를 도울 수 있기를 바랍니다.
마르코에 감사합니다
해결책
내가 아는 한, IOS4 SDK는 removeallannotations와 같은 것이 없다.
NSArray *ants = [mapView_ annotations];
[mapView_ removeAnnotations:ants];
오버레이도 마찬가지입니다
NSArray *ants = [mapView_ overlays];
[mapView_ removeOverlays:ants];
지금까지 내가 찾은 가장 좋은 방법입니다.
다른 팁
단지 removeAllAnnotations
MapView에 새 것들을 추가하면지도의 주석이 새로 고쳐집니다.
제휴하지 않습니다 StackOverflow