how to hide and re show annotations with a button

Tag: ios , objective-c , annotations , mapkit Author: beetle2010 Date: 2014-04-22

I am trying to hide and show an annotation with a button on my map view. I have figured out how to remove the annotation, but I have not figured out how to show it again. Here is my code

- (IBAction)showGym:(id)sender {

[_mapView removeAnnotation:_gym];

}

After removing it, the only way to show it again is to add it back using addAnnotation (same way you added it in the first place).