before displaying Pins on the map, i have to make sure to remove them from the map so that it will never be over displayed because the procedure of displaying is placed in the viewWillAppear
method. My relevant code is this :
-(void)viewWillAppear:(BOOL)animated{
//before doing anything, i want to remove all Pins
RMMarkerManager *markerManager=[mapView markerManager];
[mapView setDelegate:self];
[mapView setBackgroundColor:[UIColor grayColor]];
[mapView moveToLatLong:currentLocation];
[mapView.contents setZoom: 13];
[self.view addSubview:mapView];
RMMarker *marker=[[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"marker-blue.png"]];
[marker setTextForegroundColor:[UIColor blueColor]];
[marker changeLabelUsingText:@"Vous ĂȘtes ici"];
[markerManager addMarker:marker
AtLatLong:currentLocation];
[marker release];
}
How can i do that please? thanx in advance
It can just be done by calling the removeMarkers
method of the RMMarkerManager
, so it will be this :
-(void)viewWillAppear:(BOOL)animated{
//remove all markers before starting
RMMarkerManager *markerManager=[mapView markerManager];
[markerManager removeMarkers];
//do what ever you want...
}