Remove particular GMSMarker from GMSMapview using Google Map sdk in ios

后端 未结 9 3034
-上瘾入骨i
-上瘾入骨i 2021-02-19 23:18

I am integrating google maps sdk. Its all work fine. But how to remove particular Marker(Pin Point) when second will appear.(I am not using Mapkit)

I want the following:

9条回答
  •  梦毁少年i
    2021-02-20 00:10

    This worked for me -

    func removeMarkers(mapView: GMSMapView){
        for (index, _) in markers.enumerate() {
            //print("Item \(index): \(element)")
                        self.markers[index].map = nil
        }
    }
    

    where

        var markers = [GMSMarker]()
    

    markers contains all the marker overlays for the mapView

提交回复
热议问题