SwiftER
SwiftER

Reputation: 1255

Swift how to hide info window programmatically

I'm using google map for swift. I would to know if theres a method that I can use to hide the info Window whenever I use the delegate will move

func mapView(mapView: GMSMapView, willMove gesture: Bool) {
    if gesture {
                  // Hide info window here
    }
}

map enter image description here

Upvotes: 2

Views: 2081

Answers (1)

Christian Abella
Christian Abella

Reputation: 5797

The active info window is stored in selectedMarker of GMSMapView. Set it to nil and the info window will disappear.

func mapView(mapView: GMSMapView, willMove gesture: Bool) 
{
  if mapView.selectedMarker != nil
  {
    mapView.selectedMarker = nil
  }
}

Upvotes: 7

Related Questions