내 응용 프로그램에는 MKMapView
이 있으며 현재 보이는지도 영역의 중심 좌표를 가져 오려고합니다. 나는 다음과 같은 방법을 사용하여 사용자가 가시 영역을 움직이면 새로운 중심 좌표를 얻게됩니다.MKMapView centerLocation
- (void)mapView:(MKMapView *)mapView1 regionDidChangeAnimated:(BOOL)animated
{
CLLocationCoordinate2D centre = [mapView centerCoordinate];
NSLog(@"MAP CENTER = %f,%f",centre.latitude,centre.longitude);
}
문제는 I가 두 회 MAP CENTER = 0.000000,0.000000
제공 MKMapView
포함 UIViewController
전환하면 다음 실제 좌표 MAP CENTER = 55.755786,37.617633
을 제공한다는 것이다. 나는 그 좌표를 UIViewController
으로 바꾸 자마자 실제 좌표를 원한다.
을 반환 할 수 있습니다.이 코드는 'MKUserLocation * userLocation = userView.userLocation; MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance ( userLocation.location.coordinate, 500000, 500000); [mapView setRegion : 지역 애니메이션 : NO]; ' 이 코드를 제거하면'centerCoordinate'는'30.0000, -40.0000'입니다. 나는 그 중 하나도 원하지 않습니다. 잠시 동안이 문제를 극복하기 위해 정적'centerCoordinate '를 넣었습니다. –