繁体   English   中英

在 iconView 的帮助下,在 ios swift 中的谷歌 map 上没有绘制多个标记

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM