Search code examples
iosgoogle-maps-sdk-iosuipangesturerecognizer

Temporarily block google maps gesture recogniser


Context:

Google maps controller which has a slide menu on it's right and left.

Problem:

When the user opens the left or right slide menu the google map slides together with the menu which is an unwanted user experience.

Question:

How can I block google maps gesture recogniser when I slide my menus and enable it again when my slide has been finished?


Solution

  • This behaviour can be controlled by setting the value of scrollGestures.

    Example:

    //in case you want to disable GMSMapView from receiving your dragging
    mapView.settings.scrollGestures = false
    //in case you want to enable GMSMapView to receive dragging gestures again
    mapView.settings.scrollGestures = true
    

    Setting this value reflects immediately on the behaviour of the GMSMapView.