下面是我用来将像素转换为坐标的代码段,反之亦然。
CLLocationCoordinate2D currentLocation = CLLocationCoordinate2DMake(geoPoint.latitude, geoPoint.longitude);
[mapView setCenterCoordinate:currentLocation];
CGPoint centerScreenPoint = [mapView coordinateToPixel:mapView.centerCoordinate];
CLLocationCoordinate2D loc = [mapView pixelToCoordinate:centerScreenPoint];
第一行的geoPoint 是CLLocationManager报告的当前位置。虽然 centerScreenPoint 给了我160,284这是iPhone 5的中心点,但在运行此代码并转储 currentLocation 和 loc 的值后,我获得两个不同的坐标。
这些观点如何产生不同,有什么想法?