How to disable Google Maps double tap zooming?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How to disable Google Maps double tap zooming?



How to disable Google Maps SDK double tap zooming (but not pinch zooming) in iOS SDK?



Thank You




4 Answers
4



For Swift 2.1



You can do this on your GMSMapView object,


GMSMapView


mapView.settings.zoomGestures = false



Same goes for disabling tilt gesture, rotate gesture, scroll gestures,


mapView.settings.tiltGestures = false
mapView.settings.rotateGestures = false
mapView.settings.scrollGestures = false



Read more here: https://developers.google.com/maps/documentation/ios-sdk/controls#map_gestures



Unfortunately there is no way to disable double tap zoom while still keeping pinch zoom gestures. (I could be wrong, but I have went through their docs and haven't found a way to do so)



try this :


[googleMapView.settings setAllGesturesEnabled:NO];





he said that he wants to disable only double taps. this will disable all
– Daij-Djan
Nov 3 '13 at 9:45



install your own tapgesturerecognizer and make it receive double taps. that way it won't be given to the google map.



put this in controller


/// this gesture will disable zoom gesture temporarily
var tmpDisableZoom: UITapGestureRecognizer!
/// how long you want to lock
let lockDoubleTapTimeDelay = 0.3
/// finally unlock time
var unlockDoubleTapTime = Date().timeIntervalSince1970
override func viewDidLoad()
mapView.settings.consumesGesturesInView = false
tmpDisableZoom = UITapGestureRecognizer(target: self, action: #selector(removeZoomGesturesTemporarily))
tmpDisableZoom.numberOfTapsRequired = 1

@objc func removeZoomGesturesTemporarily(sender:UIGestureRecognizer)
mapView.settings.zoomGestures = false
unlockDoubleTapTime = Date().timeIntervalSince1970
DispatchQueue.main.asyncAfter(deadline: .now() + lockDoubleTapTimeDelay) [weak self] in
guard self != nil else return
let timeNow = Date().timeIntervalSince1970
if timeNow - self!.unlockDoubleTapTime > self!.lockDoubleTapTimeDelay
self!.mapView.settings.zoomGestures = true








By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS