有没有什么方法可以快速测试MKCoordinateRegion的好坏?我将纬度换成了经度,并导致应用程序崩溃。我希望在实际执行之前能够查看是否有可能执行setRegion。MKCoordinateRegionMake会测试我给它的值吗?
谢谢。
发布于 2010-02-04 12:54:16
原来我在什么地方把纬度和经度调换了。下面是我最终使用的代码:
// check for sane span values
if (currentRegion.span.latitudeDelta <= 0.0f || currentRegion.span.longitudeDelta <= 0.0f) {
currentRegion.span.latitudeDelta = 1.0f;
currentRegion.span.longitudeDelta = 1.0f;
}
// check for sane center values
if (currentRegion.center.latitude > 90.0f || currentRegion.center.latitude < -90.0f ||
currentRegion.center.longitude > 180.0f || currentRegion.center.longitude < -180.0f
) {
// Take me to Tokyo.
currentRegion.center.latitude = 35.4f;
currentRegion.center.longitude = 139.4f;
}https://stackoverflow.com/questions/2184675
复制相似问题