MKMapView 基于图块的叠加

发布于 2024-08-19 08:04:09 字数 125 浏览 3 评论 0原文

我想在 MKMapView 顶部绘制基于图块的叠加层,但没有明显的方法可以做到这一点。

这似乎很棘手,因为您可以使用 MKMapView 缩放到任何级别(与 Google 地图不同)。

有人尝试这样做吗?

I want to draw a tile-based overlay on top of a MKMapView, but there's no obvious way to do this.

This appears to be tricky since you can zoom to any level with MKMapView (unlike Google Maps).

Has anyone attempted to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

人生百味 2024-08-26 08:04:09

如果这个问题仍然受到关注,读者应该查看 WWDC2010 中的 HazardMap 和 TileMap 演示代码。

Incase this question is still getting views readers should check out the HazardMap and TileMap demo code from WWDC2010.

勿挽旧人 2024-08-26 08:04:09

我正在开发一款游戏,我需要在地图上叠加对象并让它们随地图滚动和缩放。

使用注释视图我已经能够解决第一个问题并部分解决第二个问题。注释会自动随地图移动。为了缩放它们,我使用 mapView:regionDidChangeAnimated: 委托方法在缩放事件后调整注释的大小。问题是注释在缩放手势完成之前不会重新缩放。

除了向 Apple 提交错误,要求他们提供地图叠加 API 之外,我还可以想到两种方法:

  1. 在 MKMapView 顶部放置一个(大部分不可见)视图,拦截缩放和滚动事件,处理它们,并将它们传递到地图视图。

  2. 使用 Open Street Map 中的图块自定义开源 RouteMe 库CloudMade(前者慢,后者花钱)。但它是完全开源的,因此您应该能够根据自己的喜好进行叠加。您还可以运行自己的图块服务器,在服务器上进行图块覆盖。

I'm working on a game where I need to overlay objects on the map and have them scroll and zoom with the map.

Using annotation views I've been able to solve the first problem and partially solve the second problem. Annotations automatically move with the map. For scaling them, I use the mapView:regionDidChangeAnimated: delegate method to resize my annotations after a zoom event. The problem is that the annotations don't rescale until after the zoom gesture is complete.

I can think of two approaches other than filing a bug with Apple requesting that they provide an API for map overlays:

  1. Put a (mostly invisible) view over the top of the MKMapView that intercepts zoom and scroll events, handles them, and passes them on to the map view.

  2. Customize the open-source RouteMe library with tiles from Open Street Map or CloudMade (the former is slow, the latter costs money). But it's fully open source so you should be able to do overlays to your heart's content. You could also run your own tile server that does the tile overlays on the server.

未央 2024-08-26 08:04:09

我后来发现的东西:

不完全是基于图块的解决方案,但仍然很有趣。

Something I discovered later:

http://www.gisnotes.com/wordpress/2009/10/iphone-devnote-14-drawing-a-point-line-polygon-on-top-of-mkmapview/

Not quite a tile-based solution, but interesting nonetheless.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文