简体   繁体   English

当我的MKTileOverlay集中没有图块时,使MapView显示普通的Apple Maps

[英]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.

相关问题 即使我的iOS设备中没有Google地图,“ canOpenURL”也返回true? - 'canOpenURL' returning true even when I don't have google maps in my iOS device? 当我的字符串中没有表情符号时,NSString崩溃 - NSString crash when I don't have emoji in my string 为什么我没有在 xcode 中使用苹果登录 - why i don't have sign in with apple in xcode 为什么我必须在Apple sdk中没有任何IBOutlets时将IBOutlet标识符添加到我的委托? - Why I have to add IBOutlet identifier to my delegate when inside apple sdk there isn't any IBOutlets? openweathermap MKTileOverlay不显示在mapview中 - openweathermap MKTileOverlay does not show in mapview MKMap不显示“打开街道地图”图块叠加层 - MKMap don't display Open Street Map tile overlay Apple Watch显示自定义图块地图 - Apple Watch show custom tile maps 我怎样才能让我的路径看起来更像苹果或谷歌在地图上绘制他们的路径? - How can I make my path look more like apple or google draws their path on maps? 如果我没有运行APNS(Apple推送通知服务器)的反馈服务怎么办? - What if I don't have the feedback service from APNS (Apple push notification Server) running? 为什么在打开苹果地图时出现“由于内存压力而终止”的问题? - Why do I have “Terminated due to Memory Pressure” when opening apple maps?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM