如何从GMSCameraPosition检索GMSCoordinateBounds?我想知道每次用户移动相机时在 map 上的可见坐标(至少东北/西南点),如下所示:

(void)mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition *)position

最佳答案

GMSVisibleRegion visibleRegion = mapView.projection.visibleRegion;
GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithRegion:visibleRegion];

// we've got what we want, but here are NE and SW points
CLLocationCoordinate2D northEast = bounds.northEast;
CLLocationCoordinate2D southWest = bounds.southWest;

关于ios - didChangeCameraPosition获取可用坐标的边界框/矩形,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23770999/

10-09 22:36