0

The solution online to remove overlays and refresh mapview does absolutely nothing. I am sure I have all the delegates set correctly and everything hooked up. Looking for creative ways to solve this problem. What I intend to do is to show "directions" (the polyline) to new destination coordinates only, but not the old destination. But once they are added, they cannot be removed it seems...

 [mapView removeOverlays:[mapView overlays]];

and

 [mapView setNeedsDisplay];

both does nothing!

Daniel
  • 23,129
  • 12
  • 109
  • 154
minjiera
  • 336
  • 3
  • 16

2 Answers2

0

Are you sure there is nothing else wrong? The method to remove an overlay works fine, I use it all the time like this:

if (_directionsOverlay != nil) {
    [self.mapView removeOverlay:_directionsOverlay];
    _directionsOverlay = nil;
}
myell0w
  • 2,200
  • 2
  • 21
  • 25
0

Make sure the call runs on the UI thread.

goelectric
  • 320
  • 3
  • 10