在 iOS 中移动 Google 地图信息 Window

Moving Google Maps Info Window in iOS

所以我有一个自定义信息 window,只要用户点击 Google 地图中的图钉,它就会出现。但是,我希望信息 window 在用户点击图钉时显示在屏幕底部,而不是默认情况下显示在图钉上方。基本上,当您点击图钉时,地图会像往常一样以图钉为中心,但我希望信息 window 显示在屏幕的最底部,Google 地图徽标上方。我目前正在使用此功能来显示自定义信息 window:

func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> 
UIView? {
    let infoWindow = Bundle.main.loadNibNamed("customInfoWindow", owner: self, options: nil)?.first! as! customInfoWindow
    infoWindow.title.text = marker.title
    return infoWindow
}

根据上面的 post,我认为您需要添加自定义标签而不是默认信息 window。实现以下委托方法。

func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
    // Add a Label on the Map at the desired position,
    // get the coordinates of the marker from 'marker.position'
    // use the coordinates for displaying it in the label or rev geo to get the address and display (according to the required spec.)
}