ios在地图画面中获取东北和西南的坐标

时间:2011-11-03 15:35:32

标签: iphone ios google-maps

我是iPhone应用程序的初学者。我将使用谷歌地图开发应用程序。 当用户在地图画面中拖动并改变地图画面的内容时,我想在当前地图画面中获取东北和西南的坐标。用户缩小/放大后,用户可以更改地图屏幕的内容。在这种情况下,我必须得到东北和西南的坐标。我没有找到相应的方法。

1 个答案:

答案 0 :(得分:3)

您可以这样做(See that question):

MKMapRect mapRect = self.mapView.visibleMapRect;

MKMapPoint cornerPointNE = MKMapPointMake(mapRect.origin.x + mapRect.size.width, mapRect.origin.y);
CLLocationCoordinate2D cornerCoordinateNE = MKCoordinateForMapPoint(cornerPointNE);

MKMapPoint cornerPointSW = MKMapPointMake(mapRect.origin.x, mapRect.origin.y + mapRect.size.height);
CLLocationCoordinate2D cornerCoordinateSW = MKCoordinateForMapPoint(cornerPointSW);