【发布时间】:2012-02-21 23:09:19
【问题描述】:
在基于位置的应用中,我们使用 MKMapPoints 来存储位置,例如当前用户位置。
当我们尝试在 MKMapView 上使用此位置时,为了设置最初显示的区域(放大用户),我们将其转换为 CLLocationCoordinate2D
有一个方便的方法:namenly: MKCoordinateForMapPoint,但在测试过程中这会产生奇怪的结果。
MKMapPoint mapPoint = MKMapPointMake(51.96, 6.3); // My area ;)
CLLocationCoordinate2D automagicCoordinate = MKCoordinateForMapPoint(mapPoint);
CLLocationCoordinate2D manualCoordinate = CLLocationCoordinate2DMake(mapPoint.x, mapPoint.y);
我希望 automagicCoordinate 和 manualCoordinate 完全相同。 但是当我在调试器中检查它时,我得到以下结果:
automagicCoordinate.latitude = (CLLocationDegrees) 85.05
automagicCoordinate.longitude = (CLLocationDegrees) -179.99
manualCoordinate.latitude = (CLLocationDegrees) 51.96
manualCoordinate.longitude = (CLLocationDegrees) 6.3
这个方法创建的坐标怎么不对?
【问题讨论】:
标签: ios mkmapview cllocation