我翻遍了Google Maps docs,這個描述似乎沒有什麼幫助。iOS:Google Maps API - markerInfoWindow vs markerInfoContents
我正在關注使用markerInfoContents
的舊tutorial,但是,當我使用委託時,它沒有返回我所期望的。
隨着markerInfoContents
:我的自定義視圖似乎覆蓋默認視圖
當我用markerInfoWindow
,結果是我所期待的:
我只是拉在一個自定義的UIView從一個像這樣的xib文件中:
func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView? {
let placeMarker = marker as! PlaceMarker
print(placeMarker.name)
if let infoView = UIView.viewFromNibName(name: "MarkerInfoView") as? MarkerInfoView {
infoView.nameLabel.text = placeMarker.name
return infoView
} else {
return nil
}
}
(與markerInfoContents
第一圖像結果替換markerInfoWindow
)同markerInfoContents
它創建的錨定件和盒子的陰影效果。當使用markerInfoWindow
時,它不會像本教程中那樣創建錨或陰影效果。
任何幫助將是偉大的!
西蒙你好,請註明答案是否能解決你的問題,謝謝。 – Efren