ios – didChangeCameraPosition获取可用坐标的边界框/矩形

前端之家收集整理的这篇文章主要介绍了ios – didChangeCameraPosition获取可用坐标的边界框/矩形前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何从GMSCameraPosition中检索GMSCoordinateBounds?每当用户移动相机时,我想知道地图上的可见坐标(至少是东北/西南点),如下所示:
(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相关文章