In my app I have two functionality when my tableview loads ,in the mapview all the pins are shown corresponding to tableData.NOw I have search bar which gives another set of values which I have to show on my mapView.Everything is working fine but second time previous pins are also shown means prevoius annotations are not deleted . So please tell me how to remove prevoius annotation so that I can show only relavent pins on mapView Thanks in advance
1
votes
2 Answers
7
votes
Simply use the MKMapView instance method "removeAnnotations:":
-(void)removeAnnotations:(NSArray *)annotations
If you want to remove all of them you can do somethign like :
[mapView removeAnnotations:mapView.annotations];
P.S: Beware that you might want to iterate through the annotations not to remove the userLocation (blue dot)
Hope this helps, Vincent