Chr*_*ris 11 iphone google-maps ios google-maps-sdk-ios
我希望能够检测用户是否缩小或移动了地图中心.我已经看过关于事件监听器的帖子但是在Javascript中我试图看看Google Maps iOS SDK中是否有类似的东西.我看到iPad Yelp应用程序有这样的东西,如果你放大/缩小或移动地图,工具栏从底部出现,让用户知道他们是否想要"重做区域搜索".我想做类似的事情,并用其他/更多标记重新加载地图.
我看过谷歌地图的参考指南,但遗憾的是没找到任何东西.如果有人有类似的东西或有关如何实现这一点的任何指导,任何信息都会很棒.提前致谢!
链接到Google地图文档我看过:
https://developers.google.com/maps/documentation/ios/reference/protocol_g_m_s_map_view_delegate-p
https://developers.google.com/maps/documentation/ios/reference/interface_g_m_s_coordinate_bounds
all*_*tio 11
我使用此委托检测相机更改,包括缩放和位置:
- (void)mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition *)position;
Run Code Online (Sandbox Code Playgroud)
编辑
使用此代码,您可以获得可见区域的角落:
NSLog(@"%f,%f",_mapView.projection.visibleRegion.farLeft.latitude,_mapView.projection.visibleRegion.farLeft.longitude);//north west
NSLog(@"%f,%f",_mapView.projection.visibleRegion.farRight.latitude,_mapView.projection.visibleRegion.farRight.longitude);//north east
NSLog(@"%f,%f",_mapView.projection.visibleRegion.nearLeft.latitude,_mapView.projection.visibleRegion.nearLeft.longitude);//south west
NSLog(@"%f,%f",_mapView.projection.visibleRegion.nearRight.latitude,_mapView.projection.visibleRegion.nearRight.longitude);//south east
Run Code Online (Sandbox Code Playgroud)