2011-11-03 74 views
0

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

回答

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);