Question

I have a working MKTileOverlay and MKPolyline on my MKMapView but need to update the polyline every second or so. I do this currently by removing the old line and adding a new one with the next point added. At the moment this does work but causes the tiles of the MKTileOverlay to be reloaded. Is it possible to have a mutable polyline or replace it without reloading all of the tiles?

Was it helpful?

Solution

Similar to [UIView drawRect:], the new MKTileOverlayRenderer descends from MKOverlayRenderer and has rect-based screen updates. So you could figure out the start point of your mutable segment addition, the end point, and use those as opposite corners on an MKMapRect which should be refreshed. That is, you'd just refresh the overlay tile(s) involved with the new segment, not the whole path.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top