Is there an event listener in Google Map to pan or zoom the map?

I want to determine if the user has been reduced or the center of the map has been moved. I saw a message about an event listener, but in Javascript, and I'm trying to see if there is anything in the Google Maps iOS SDK like this. I see that the iPad Yelp app has something like this, where if you zoom in or out or move the map, the toolbar appears at the bottom and lets the user know if they want to "Repeat the search in the zone". I want to do something like this and reload the map with other markers.

I looked at the Google Map Reference Guide, but unfortunately I didn’t find anything. If someone has something similar to this or there is some kind of guidance on how to do this, any information would be great. Thanks in advance!

Link to Google Map documentation I looked:

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

+8
ios iphone google-maps google-maps-sdk-ios
source share
3 answers

I use this delegate to detect camera changes, which includes zoom and position:

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

EDIT

with this code you can get the angles of the visible area:

 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 
+9
source share

Try delegating the - (void)mapView:(GMSMapView *)mapView willMove:(BOOL)gesture , the BOOL parameter tells you that the mapView is being moved by the user or not.

+6
source share

To determine the end of moving / zooming a Google map view:

I came across this question while trying to figure out how to find a google map with move / zoom to get the center of the map. I tried to capture this event in didChangeCameraPosition , as suggested by Allemattio, but it causes multiple times when we pan or scale the map. Fortunately, I found another delegate display method that is called when we finish panning or zooming the map view:

 -(void)mapView:(GMSMapView *)mapView idleAtCameraPosition:(GMSCameraPosition *)position { NSLog(@"mapView ended with panning/zooming in %s",__PRETTY_FUNCTION__); } 
+1
source share

All Articles