[英]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. 我正在使用使用“自定义”地图的iOS地图,该地图将completley存储在我的应用程序中,因此始终可以脱机访问它。 I am using a custom MKTileOverlay URL to my local file store to make this happen, etc.
我正在使用自定义MKTileOverlay URL到我的本地文件存储,以实现此目的,等等。
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. 但是,由于我的应用程序地图仅覆盖一小块地理区域,因此我希望在这种情况下让MapView显示标准的Apple Map。 When I overlay the map and set "canReplaceMapContent" to true, I just get a blank white space for map tiles that aren't present.
当我覆盖地图并将“ canReplaceMapContent”设置为true时,我只是获得了空白的空白区域,用于不存在的地图图块。
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. 我真的不想将canReplaceMapContent设置为FALSE,因为大多数情况下,用户将使用我的(自定义)地图,因此我不希望渲染Apple地图的开销会被完全覆盖。
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? 有什么方法可以使函数返回“ nil”或告诉MapKit不要使用TileOverlay,而可以使用常规Apple地图代替吗?
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
. 不,但是有一个主意:有两个具有相同框架的
MKMapView
,一个具有您的自定义地图,并且canReplaceMapContent = YES
,另一个没有和NO
。 You can hide one and show the other, transferring annotations if necessary, and you might be able to produce a convincing swap. 您可以隐藏一个,然后显示另一个,并在必要时传输注释,也许可以产生令人信服的交换。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.