Is there a way to draw under names in MKMapView?

坚强是说给别人听的谎言 提交于 2019-12-11 16:35:09

问题


I've looked at the many fine threads on how to draw routes on an MKMapView and didn't see anything on this.

I want to be able to draw information (e.g. traffic flow imagery for routes, possibly annotations) over the map terrain but under road names and numbers etc.

It seems likely that there's no way to do this since the map / road names aren't exposed as separate layers in the mapkit?

It does sound like I could draw a route under road names but that's because I can use Apple's API for that and presumably Apple is laying down the information in the order names > route > map data in the tiles that they send back to me when I use that approach...

Even just hearing that this can't be done would be good to know!

And, presumably it can't be done with google maps either?

Thanks in advance!

ETA


回答1:


I'm pretty sure it isn't possible to change the draw order. Overlays are always drawn on top of the map tiles. You can however use alpha in your overlay so as not to obscure the road names. It might also be possible to find a blend mode that makes it appear as though your information is below the name although after a short play with these I didn't find a mode that had that much effect. I think that the overlays are rendered to a separate bitmap (for performance reasons) and then drawn over the map tiles so that might affect how blend modes work. (EDIT: I've read another post since that suggests that blend modes don't work with overlays).



来源:https://stackoverflow.com/questions/15397796/is-there-a-way-to-draw-under-names-in-mkmapview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!