didChangeCameraPosition get bounding box/ rectangl

2020-06-17 05:43发布

How can I retrieve the GMSCoordinateBounds from a GMSCameraPosition? I want to know the visible coordinates on the map (at least Northeast/Southwest points) everytime the user moves the camera as in:

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

1条回答
一纸荒年 Trace。
2楼-- · 2020-06-17 06:11
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;
查看更多
登录 后发表回答