2010-04-20 3 views
0

현재 아이폰의 위치를 ​​나타내는 푸른 색의 방사 아이콘에 mapView.showsUserLocation=YES;을 사용하지만 좌표를 가져 오는 방법을 모릅니다. locationManager : didUpdateToLocation : fromLocation : mapView.userLocation.location

self.locationManager = [[[CLLocationManager alloc] init] autorelease]; locationManager.delegate = self; locationManager.distanceFilter=kCLDistanceFilterNone; //record every movement locationManager.desiredAccuracy=kCLLocationAccuracyBest; [locationManager startUpdatingLocation]; I 시도

중 둘 yourGPS=newLocation.coordinate;didUpdateToLocationyourGPS=mapView.userLocation.location.coordinate; 하지만 대부분의 시간 I 앞으로 이동 mapView.showsUserLocation=YES; 제어 청색 기포 (볼 수있는 구성으로 locationManager:didUpdateToLocation:fromLocation: 시도했지만 didUpdateToLocation에 기록 된 좌표는 변경되지 않습니다.

파란색 버블을 구동하는 좌표를 계속 기록하려면 yourGPS=mapView.userLocation.location.coordinate;을 입력해야합니까?

감사합니다.

답변

1

이것은 내가 내 응용 프로그램에서 사용하는 것입니다 다음 mapView.showsUserLocation=YES;는 메모리 누수를 제공

- (void)center 
{ 
    NSLog(@"Centering..."); 
    MKCoordinateRegion newRegion; 
    newRegion.center.latitude = mapView.userLocation.location.coordinate.latitude; 
    newRegion.center.longitude = mapView.userLocation.location.coordinate.longitude;   
    newRegion.span.latitudeDelta = 0.112872; 
    newRegion.span.longitudeDelta = 0.109863; 

    [mapView setRegion:newRegion animated:YES]; 
} 
0

때문에, 나는 그것을 사용을 중단하고, 단지 좌표를 얻기 위해 locationManager를 사용했다. 그것의 단점은 사랑스러운 푸른 거품을 잃어 버리는 것입니다. 나는 그것을 어떻게 만들어야할지 모릅니다.

관련 문제