Swift - GoogleMaps SDK获得单指或双指点击手势



我在我的项目中使用了Google Maps SDK。我想检查并检测何时点击使用单指或双指的谷歌地图? 我的要求是,禁用单指使用并启用双指使用。我希望所有手势都适用于双指而不是单指。

首先,禁用GMSMapView实例上的所有手势。文档 说:

You can disable the default gestures on the map by setting properties of the GMSUISettings class, which is available as a property of the GMSMapView

资料来源:https://developers.google.com/maps/documentation/ios-sdk/controls

然后,您可以添加一些UITapGestureRecognizer:

来源: https://developer.apple.com/documentation/uikit/uitapgesturerecognizer

不要忘记将numberOfTouchesRequired设置为2

来源: https://developer.apple.com/documentation/uikit/uitapgesturerecognizer/1623580-numberoftouchesrequired

最新更新