如何在谷歌地图的群集管理器中快速添加带有标记图标视图的标记

时间:2019-03-30 06:33:55

标签: ios swift

enter image description here我需要在Google地图上显示带有图标视图的标记,但是标记很容易添加到集群管理器中,而没有添加带有图标视图的标记。单击标记时,无需显示信息窗口。我只需要显示已打开的默认标记图标视图即可。

for i in 0..<dataArr.count{

   let latitude = dataArr[i].lat ?? ""
   let longitude = dataArr[i].longs ?? ""

   let marker = GMSMarker()

   marker.position = 
     CLLocationCoordinate2D(latitude:CLLocationDegrees(latitude)!, 
     longitude: CLLocationDegrees(longitude)!)


   marker.userData = i

   marker.icon = UIImage(named: "CustomImage")
   marker.iconView = addressWindow //UIView type XIB

   let doubleLat = Double(latitude)
   let doubleLong = Double(longitude)

   let name = "Item \(i)"

  clusterDataArr.setValue("\(dataArr[i].id ?? "")", forKey: "Item \ 
 (i)")


 if let item = POIItem(position: 
 CLLocationCoordinate2DMake((doubleLat)!, (doubleLong)!), name: 
 name) as? POIItem{

             clusterManager.add(item)

             clusterManager.cluster()

       }

   }

0 个答案:

没有答案