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:
If i tap on map then one marker pin is generate at that location now if i tap on another location on map then two pins are displayed but i want to remove the old marker pin.
I also use,
[self.mapView clear];
But it was clear all other marker points from GMSMapview.
Following is the code to add pin on Map:
GMSMapView *mapView;
GMSMarker *currLocMarker = [[GMSMarker alloc] init];
currLocMarker.map = nil;
[currLocMarker setTitle:NSLocalizedString(@"current_location_title", nil)];
currLocMarker.icon = [UIImage imageNamed:@"pin_fetch_location.png"];
currLocMarker.position = CLLocationCoordinate2DMake(pCoordinate.latitude, pCoordinate.longitude);
currLocMarker.map = self.mapView;
Please help me to solve out this stuff..!!
Thanks in advance..:)
To remove a particular pin from GMSMapView keep reference of pin (if there are multiple then use array) then use this code
currLocMarker.map = nil;
To remove all things including pins poly lines from GMSMapView use this code
[ _mapView clear];