Ios didTapInfoWindowOfMarker未执行
我试图简单地获得一个标记的坐标,该标记已被用户选择,然后在谷歌地图中使用。但是,当用户点击标记器的信息窗口时,我无法调用didTapInfoWindowOfMarker函数(“调用的didTap”从未打印到控制台),因此无法获取点击标记器的坐标 这是我的密码:Ios didTapInfoWindowOfMarker未执行,ios,swift,google-maps-sdk-ios,Ios,Swift,Google Maps Sdk Ios,我试图简单地获得一个标记的坐标,该标记已被用户选择,然后在谷歌地图中使用。但是,当用户点击标记器的信息窗口时,我无法调用didTapInfoWindowOfMarker函数(“调用的didTap”从未打印到控制台),因此无法获取点击标记器的坐标 这是我的密码: extension MapViewController: GMSMapViewDelegate { func mapView(mapView: GMSMapView!, didTapInfoWindowOfMarker mark
extension MapViewController: GMSMapViewDelegate {
func mapView(mapView: GMSMapView!, didTapInfoWindowOfMarker marker: GMSMarker!) {
print("Called didTap")
let googleMarker = mapView.selectedMarker
let markerValue: CLLocationCoordinate2D = googleMarker.position
let markerLat = markerValue.latitude
let markerLong = markerValue.longitude
print("markerLat: \(markerLat)")
print("markerLong: \(markerLong)")
mapView.selectedMarker = nil
mapView.delegate = self
}
}
您必须设置委托。将哪个委托设置为什么@NHGRIFT映射视图的委托给self。我已经在viewDidLoad()中完成了此操作@我把它弄坏了。必须将mapView.delegate=self更改为self.mapView.delegate=self。感谢您回复@nhgrif!您必须设置委托。将哪个委托设置为什么@NHGRIFT映射视图的委托给self。我已经在viewDidLoad()中完成了此操作@我把它弄坏了。必须将mapView.delegate=self更改为self.mapView.delegate=self。感谢您回复@nhgrif!