특정 위치의 시작 센터에 앱이 있습니다.ios6 visibleMapRect not correct
//Calculate and set new center point
CLLocationCoordinate2D zoomLocation = CLLocationCoordinate2DMake(<some lat>,<some long>);
MKCoordinateSpan span;
span.latitudeDelta = 0.08;
span.longitudeDelta = 0.08;
//MKCoordinateRegion region = MKCoordinateRegionMake(zoomLocation, span);
MKCoordinateRegion region = [mapView regionThatFits:MKCoordinateRegionMake(zoomLocation, span)];
[mapView setRegion:region animated:YES];
[self refreshMap];
refreshMap을 호출하면 데이터베이스의 각 정보를 쿼리 할 수 있도록 맵의 경계 상자가 계산됩니다. 내가보고하고
//Calculate map's bounding box
MKMapRect mapRect = [mapView visibleMapRect];
MKMapPoint cornerPointNE = MKMapPointMake(MKMapRectGetMaxX(mapRect), mapRect.origin.y);
CLLocationCoordinate2D upperLeft = MKCoordinateForMapPoint(cornerPointNE);
MKMapPoint cornerPointSW = MKMapPointMake(mapRect.origin.x, MKMapRectGetMaxY(mapRect));
CLLocationCoordinate2D lowerRight = MKCoordinateForMapPoint(cornerPointSW);
if(fabs(upperLeft.longitude) > 80.00 || fabs(lowerRight.longitude) > 80.0) {
return;
}
문제는 아이폰 OS 6에 lowerRight가 제대로 응용 프로그램의 시작과 lowerRight.longitude가> 80.0을 그대로 상쾌하지 않는지도 데이터에서 계산되지 않습니다 좌표입니다. upperLeft가 올바르게 계산됩니다.
경계 상자 계산이 조금이라도지도를 패닝해도 앱로드가 완료된 후.
이 코드는 콜백지도보기 이외 있습니까
아이폰 OS 5에 잘 작동 : 그에게 내가 사용할 수 regionDidChangeAnimated? 나머지 refreshMap은 상당히 집약적이어서 패닝 성능에 영향을 미치고 싶지 않습니다.
TIA
UPDATE는
나는 수정을 발견 한 것 같다. 대신이
[mapView setRegion:region animated:YES];
을하는 나는
[mapView setRegion:region animated:NO];
지금은 낮은 코너가 제대로 응용 프로그램 시작시 계산 NO
에 YES를 변경했습니다.
위도가 -180에서 180 사이이므로 경도가 80보다 큰지 확인하는 이유가 궁금합니다 (위도는 -90에서 90 사이 여야 함). – Anna
그 라인을 넘지 않는 미국의 특정 주에 대해서만 염려한다는 점에서 80보다 큰 경도를 검사하고 있습니다. 이는 어리석은 고도에서 전체 데이터베이스가 쿼리되고 표시되는 것을 방지하는 방법이었습니다. –