简体   繁体   中英

Make MapView display normal Apple Maps when I don't have a tile in my MKTileOverlay set

I am working on an iOS map that uses a "custom" map, stored completley in my application so it can always be accessed offline. I am using a custom MKTileOverlay URL to my local file store to make this happen, etc.

However, as my application's map only covers a small geographic area, I would like to have have the MapView display the standard Apple Map in such cases. When I overlay the map and set "canReplaceMapContent" to true, I just get a blank white space for map tiles that aren't present.

I don't really want to set canReplaceMapContent to FALSE, because most of the time a user will be using my (custom) map, so I wouldn't want the overhead of rendering the Apple map that would be completely covered.

Is there any way I can return a "nil" to a function or something to tell MapKit to not use the TileOverlay, and just use the regular Apple map instead?

No, but here's an idea: have two MKMapView s with the same frame, one with your custom map and canReplaceMapContent = YES and the other without and NO . You can hide one and show the other, transferring annotations if necessary, and you might be able to produce a convincing swap.

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