I have a item list table. When I select a row of my table, I show a view with more information and a map with the placemark.
The used code is below:
MKCoordinateRegion region;
CLLocationCoordinate2D coordinate = {lat,longt};
region.center.latitude = coordinate.latitude;
region.center.longitude = coordinate.longitude;
region.span.latitudeDelta = 0.3;
region.span.longitudeDelta = 0.3;
[self.mapView setRegion:region animated:YES];
MKPlacemark *mPlacemark = [[[MKPlacemark alloc] initWithCoordinate:coordinate addressDictionary:nil] autorelease];
[mapView addAnnotation:mPlacemark];
[mPlacemark release];
The problem is that when I select another item after the previously selected item in my map displays the new placemark and those previously. How to remove the previously placemark from my map??
Try with removing the previously added placemark.
Like :
Declare
mPreviousPlacemarkas theretainproperty of your class.