Search code examples
iosgoogle-mapsgoogle-maps-sdk-ios

How to remove GMSPolygon from GMSMapView


Does exist any way to remove GMSPolygons from GMSMapView?

It does not seem to exist a property of GMSMapView containing them (as GMSPlolyLines), should I clear the map and render all again?

thanks


Solution

  • When you create the GMSPolygon you set its map property to add it to the map. To remove it from the map, set its map property to nil. This means you need to keep your own record of the polygons which you've added to the map, which you want to be able to remove later.

    For example mySavedPolygon.map = nil