如何检测点击Google Maps iOS Swift的时间?

rez*_*afi 0 google-maps tap gesture ios swift

我想检查并检测何时点击地图标记或其他任何东西。在这种情况下,iOS Swift 4中的Google地图是否存在任何委托?

谢谢。

小智 5

 func mapView(_ mapView: GMSMapView, didTapAt coordinate: CLLocationCoordinate2D) {
 //Write your code here...
 }
Run Code Online (Sandbox Code Playgroud)

如果未调用委托函数,则在viewDidAppear()方法或LocationManager didUpdateLocations()方法中设置mapview委托。