Remove particular GMSMarker from GMSMapview using Google Map sdk in ios

后端 未结 9 3223
-上瘾入骨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条回答
  •  逝去的感伤
    2021-02-20 00:11

    swift 5

    func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool
    {
        let alertcontrolserver = UIAlertController.init(title : nil, message : "Are you sure you want to Remove ! ", preferredStyle: .alert)
            let okbtn = UIAlertAction(title: "Yes", style: .default, handler: { UIAlertAction in  marker.map = nil
                 })
        let cancelbtn = UIAlertAction(title: "No", style: .default, handler: nil)
            alertcontrolserver.addAction(okbtn)
           alertcontrolserver.addAction(cancelbtn)
            self.present(alertcontrolserver, animated: true, completion: nil)
        return true
    }
    

提交回复
热议问题