I have two trails(Blue and Red in color, say) (MKPolyline) overlays which I add to my MapView using the addOverlay method. Then, I have defined the viewForOverlay method and the trails get loaded fine onto the map. But the problem is I want the blue one to be on the top of the red one but the opposite happens.
How can I get my red trail to get on top of the blue trail when they overlap?
The method mapView:viewForOverlay:
was deprecated as of iOS 7.0 see:
The new method to use is mapView:rendererForOverlay:
with MKPolylineRenderer
objects.
To put your blue overlay on top of your red one, the following method can be used:
insertOverlay:aboveOverlay:
Apple's docs describe the adding and inserting of overlay methods in detail:
Good luck!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.