I have a map in a tab of a tabbarcontroller. the user can go to another tab and re-set preferences and I need to re-draw the map when the user returns. I currently use this method to clean out and replot my new annotations:
- (IBAction)refreshTapped:(id)sender {
//Clean out old annotations
for (id<MKAnnotation> annotation in _mapView.annotations) {
[_mapView removeAnnotation:annotation];
}
//THIS Adds the new annotations
for (MyLocation *annotation in self.myLocationsToSort) {
//Add annotation to mapview
[_mapView addAnnotation:annotation];
}
}
The problem is that I have a UIActivityIndicator being turned off in mapviewDidFinishLoading. So the second time the user returns to the map view the indicator never gets removed. Should that indicator be removed at the end of my plotting method or should I somehow force the view to reload the map view and thus call the mapviewDidFinishLoading method again?