本文介绍了didChangeCameraPosition获取可用坐标的边界框/矩形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从GMSCameraPosition中检索GMSCoordinateBounds?每当用户移动摄像机时,我都想知道地图上的可见坐标(至少是东北/西南点):
(void)mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition *)position解决方案
GMSVisibleRegion visibleRegion = mapView.projection.visibleRegion; GMSCoordinateBounds * bounds = [[GMSCoordinateBounds alloc] initWithRegion:visibleRegion]; //我们得到了我们想要的东西,但是这里是NE和SW点 CLLocationCoordinate2D northEast = bounds.northEast; CLLocationCoordinate2D southWest = bounds.southWest;
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解决方案 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;
更多推荐
didChangeCameraPosition获取可用坐标的边界框/矩形
发布评论