MKPolyLineRenderer change color without removing o

2020-07-26 12:02发布

问题:

I am developing an application that almost replicates Apple maps application behavior. When i touch a route, i need to change its color to blue and change the other ones colors to gray. Is there an efficient way to accomplish this without having to remove the overlays and adding them again ? Thanks.

回答1:

Yes:

  1. Make sure your annotation view has enabled = YES.

  2. Implement -[MKMapViewDelegate mapView:didSelectAnnotationView:].

  3. In that callback, get view and change its properties.