Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/102.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何禁用谷歌地图双击缩放?_Ios_Google Maps_Google Maps Sdk Ios - Fatal编程技术网

Ios 如何禁用谷歌地图双击缩放?

Ios 如何禁用谷歌地图双击缩放?,ios,google-maps,google-maps-sdk-ios,Ios,Google Maps,Google Maps Sdk Ios,如何在iOS SDK中禁用Google Maps SDK双击缩放但不收缩缩放 谢谢试试这个: [googleMapView.settings setAllGesturesEnabled:NO]; 试试这个: [googleMapView.settings setAllGesturesEnabled:NO]; 安装您自己的TapGestureRecognitor,并使其接受双重点击。这样,它就不会出现在谷歌地图上。安装您自己的TapGestureRecognitor,并使其接受双重点击

如何在iOS SDK中禁用Google Maps SDK双击缩放但不收缩缩放

谢谢

试试这个:

  [googleMapView.settings setAllGesturesEnabled:NO];
试试这个:

  [googleMapView.settings setAllGesturesEnabled:NO];

安装您自己的TapGestureRecognitor,并使其接受双重点击。这样,它就不会出现在谷歌地图上。

安装您自己的TapGestureRecognitor,并使其接受双重点击。这样就不会出现在谷歌地图上

对于Swift 2.1

您可以在GMSMapView对象上执行此操作

禁用倾斜手势、旋转手势、滚动手势时也是如此

mapView.settings.tiltGestures = false
mapView.settings.rotateGestures = false
mapView.settings.scrollGestures = false
请在此处阅读更多信息:

不幸的是,没有办法禁用双击缩放,同时仍然保持收缩缩放手势。我可能错了,但我已经查阅了他们的文档,还没有找到这样做的方法

对于Swift 2.1

您可以在GMSMapView对象上执行此操作

禁用倾斜手势、旋转手势、滚动手势时也是如此

mapView.settings.tiltGestures = false
mapView.settings.rotateGestures = false
mapView.settings.scrollGestures = false
请在此处阅读更多信息:

不幸的是,没有办法禁用双击缩放,同时仍然保持收缩缩放手势。我可能错了,但我已经查阅了他们的文档,还没有找到这样做的方法

/// 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
        }
    }
}
把这个放在控制器里

/// 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
        }
    }
}

他说他只想禁用双水龙头。这将禁用所有他说他只想禁用双击。这将禁用所有