Is there a way to draw under names in MKMapView?

2019-09-02 14:28发布

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条回答
Animai°情兽
2楼-- · 2019-09-02 14:43

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).

查看更多
登录 后发表回答