Search code examples
iosxcodegoogle-maps-sdk-ios

how to lock GMSCameraPosition movement in GMSMapView


I want to lock the camera in Google Maps for iOS without success so far.

the goal is to point the camera to one location and prevent from the user the ability to move the camera himself. after a while i would like to give the user the camera control back

Thanks

GMSCameraPosition *camera = [GMSCameraPosition cameraWithTarget:location.coordinate zoom:mapView_.camera.zoom];    
[mapView_ animateToCameraPosition:camera];
//here i would like to lock the camera
//do some stuff
//give the user the control back

Solution

  • Have a look at the setAllGesturesEnabled method on GMSUISettings. For example:

    [mapView_.settings setAllGesturesEnabled: NO];