In the Apple documentation for the -regionThatFits:
method of the MKMapView, it says that this will return a new region centered on the same point as the region that's passed in, only with the regions bounds corrected for the iPhone screen aspect ratio. This seems to be incorrect in implementation...before the call to this method, my region shows up as:
在MKMapView的-regionThatFits:方法的Apple文档中,它表示这将返回一个新的区域,该区域以与传入的区域相同的点为中心,只有区域边界针对iPhone屏幕宽高比进行了校正。这在实现中似乎是不正确的...在调用此方法之前,我的区域显示为:
$5 = { center = { latitude = 37.322898864746094, longitude = -122.03209686279297 }, span = { latitudeDelta = 14.278411865234375, longitudeDelta = 1.5202401876449585 } }
..however, after the call to this method, I end up with:
..但是,在调用这种方法后,我最终得到:
$6 = { center = { latitude = 36.973427342552824, longitude = -122.03209686279297 }, span = { latitudeDelta = 14.521333317196799, longitudeDelta = 14.0625 } }
This is quite a big difference on the map - this translates to the distance between Cupertino, CA and Santa Cruz, CA. Anyone else experience this discrepancy?
这在地图上有很大的不同 - 这转化为加利福尼亚州库比蒂诺和加利福尼亚州圣克鲁斯之间的距离。其他人遇到这种差异吗?
1 个解决方案
#1
0
I'd assume it's a rounding issue since you used a large latitudeDelta. To make sure, your center is never altered, you could set the adjusted region first, then re-set the center to the old value by using the centerCoordinate
property.
我认为这是一个舍入问题,因为你使用了一个大的纬度德尔塔。为确保您的中心永不改变,您可以先设置调整后的区域,然后使用centerCoordinate属性将中心重新设置为旧值。
#1
0
I'd assume it's a rounding issue since you used a large latitudeDelta. To make sure, your center is never altered, you could set the adjusted region first, then re-set the center to the old value by using the centerCoordinate
property.
我认为这是一个舍入问题,因为你使用了一个大的纬度德尔塔。为确保您的中心永不改变,您可以先设置调整后的区域,然后使用centerCoordinate属性将中心重新设置为旧值。