Reputation: 349
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
Upvotes: 11
Views: 6136
Reputation: 17624
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
Upvotes: 18
Reputation: 43
This has been updated, has I am using the clear function, and was looking for a way to keep the polygons while using this.
I've just confirmed against the Google Maps API Reference.
Clears all markup that has been added to the map, including markers, polylines and ground overlays.
Upvotes: 2
Reputation: 1965
From google maps document
- clear Clears all markup that has been added to the map, including markers, polylines and ground overlays.
So you just use
[mapView clear];
This should clear the polygons.
Upvotes: 6