【问题标题】:Moving Google Maps Info Window in iOS在 iOS 中移动 Google 地图信息窗口
【发布时间】:2017-09-29 04:15:52
【问题描述】:

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

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
}

【问题讨论】:

    标签: ios swift google-maps marker infowindow


    【解决方案1】:

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

    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.)
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-20
      • 1970-01-01
      • 2013-05-15
      • 1970-01-01
      • 2018-10-15
      • 1970-01-01
      相关资源
      最近更新 更多