Remove particular GMSMarker from GMSMapview using Google Map sdk in ios
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];
I made like this:
GMSMarker *myMarker;
- (void)mapView:(GMSMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate
{
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
if (myMarker) {
myMarker.map = nil;
myMarker = nil;
}
myMarker = [[GMSMarker alloc] init];
myMarker.position = CLLocationCoordinate2DMake(coordinate.latitude, coordinate.longitude);
myMarker.title = @"title";
myMarker.map = mapView_;
}];
}
and worked well for me !