Post

Replies

Boosts

Views

Activity

Reply to Drawing MKPolylines on map make app unresponsive. Anybody else have this problem ?
Experienced the same issue as the ones mentioned before: MKMapView becoming unresponsive when adding overlays. Amount of overlays wasn't silly high which is sort of irrelevant anyway because iOS < 16 handled them well. Just found a solution: instead of adding your MKPolylines one at a time each with its own renderer, create a MKMultiPolyline instance and add that as an overlay. Change your renderer from MKPolylineRenderer to a MKMultiPolylineRenderer. Warning: this only works if your MKPolylines can be the same color, thickness etc. If you want one MKPolyline to be red and another green, you still need to create them as single instances each with their own renderer to take care of style. Consider the MKMultiPolyline and MKMultiPolylineRenderer solution as something that only works for polylines that need to be rendered in the same way. You sort of group those in a multi instance using a single renderer.
Dec ’22