Toggling MapKit Overlays On/Off by pressing the same button?
问题 I have a MapView with a toolbar button that when pushed adds overlays to the MapView. What I would like is for the button (IBAction) to check to see if there already are overlays on the map and if there are remove, if there are not, to add them. My current code that adds the overlays is as follows: - (IBAction)waterWaysAction:(id)sender { NSLog(@"WaterWays pushed"); if ([mapView overlays]) { [mapView removeOverlays:[mapView overlays]]; NSLog(@"WaterWays removed"); } else { // ******* adds the