[英]with help of iconView , multiple marker are not ploted on google map in ios swift
I am plotting multiple custom-view marker on google map in iOS swift project but some time they are not plot but when I tap on google map tappable action is call. 表示數據可用,但某些標記未繪制或不可見。
我正在使用下面的代碼
for oldSites in self.marrPlotedMarker {
let position = CLLocationCoordinate2D(latitude: tempSite["lat"].double ?? 0, longitude: tempSite["lon"].double ?? 0)
let marker = GMSMarker()
marker.tracksViewChanges = false
marker.iconView = mycustoumview()
marker.position = position
//marker.isFlat = true
marker.map = self.myMapview
}
}
您的代碼片段並沒有描繪出整個畫面,但我猜您需要在創建標記之前將self.myMapView
添加為子視圖:
所以你的代碼看起來像這樣:
self.addSubview(self.myMapView) // important piece
for oldSites in self.marrPlotedMarker {
let position = CLLocationCoordinate2D(latitude: tempSite["lat"].double ?? 0, longitude: tempSite["lon"].double ?? 0)
let marker = GMSMarker()
marker.tracksViewChanges = false
marker.iconView = mycustoumview()
marker.position = position
//marker.isFlat = true
marker.map = self.myMapview
}
請參閱此帖子以獲取類似的問題/答案: 在 Google 地圖中放置多個標記。 Swift
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.