Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Google Map Movement on double tap in iOS

I am using the Google Maps SDK for my iOS App.

You can zoom in on the map using either of two gestures.

  1. Double Tap
  2. Double Tap -> Hold -> Drag Down

In the first way, the map zooms in, but the map shifts near to the position where I double tap. While in the second method, the map zooms in staying at the current map centre.

I want to achieve the second type of behaviour(map staying on current centre rather than shifting) on the first gesture too. How do I go about it?

EDIT: Basically the behaviour should be same as the Official Google Map Double Tap.

like image 235
Arnav Patra Avatar asked Mar 18 '23 16:03

Arnav Patra


1 Answers

This is a config item in GMSUISettings class, so you can access it on your GMSMapView object's 'settings' property like below,

Obj-C:

mapView.settings.allowScrollGesturesDuringRotateOrZoom = NO;

Swift 2.1:

mapView.settings.allowScrollGesturesDuringRotateOrZoom = false

I had to dig into their source code to find this config item, its not mentioned anywhere in the docs.

like image 134
Nagendra Rao Avatar answered Apr 01 '23 20:04

Nagendra Rao