简体   繁体   中英

How two prevent loading apple map and to start with OSM MKTileOverlay

I need to display OSM overlays instead of standard apple maps in mapkit framework. But I have an issue, how can I display OSM overlay without loading apple maps? Now I just have a method

AxMapKitTileOverlay *mapOverlay = [[AxMapKitTileOverlay alloc] initWithURLTemplate:URLTemplate];
[self.mapView addOverlay:mapOverlay level:MKOverlayLevelAboveLabels];

which is loading tiled overlay - but if I run it during the map initialization - the map didn't changed, and when I use this method later - I get apple default map loaded.

Maybe I should react on some delegate method? How can I solve this?

To prevent the MapKit maps from being drawn set canReplaceMapContent which comes from MKTileOverlay

If the tile content you provide can cover the entire drawing area with opaque content, set this property to YES. Doing so serves as a hint to the map view that it does not need to draw any additional content underneath your tiles. Set this property to NO if your tiles contain any transparency.

The best place to do this is probably in your viewDidLoad method. That way it will happen before the user sees anything.

请确保您正在为要添加的叠加层实现-[MKMapViewDelegate mapView:rendererForOverlay:]方法,否则它实际上不会被绘制。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM