限制 iPad 上的 Mapkit 区域

发布于 2024-09-24 04:52:11 字数 199 浏览 0 评论 0原文

我需要一个 iPad 应用程序使用 Mapkit 显示给定的国家/地区以及一些注释。是否可以对其进行限制,以便用户无法滚动到我想要显示的区域之外的另一个区域? 例如,我的应用程序想要显示有关巴西的内容,我可以让用户无法离开该国家吗?

这个问题是关于Mapkit的,我知道我可以有一个有问题的国家的图像,并尝试获得与谷歌地图类似的效果......

谢谢!

I need to have an iPad app show a given country with some anotations using mapkit. Is it possible to limit it so the user can not scroll over to another region than the one i want to show?
For example, my app wants to show stuff about Brazil, can i make it so the user can not move away from that country?

This question is regarding Mapkit, i know i could have an image of the country at question and try to get a similar effect to google map's...

Thanks!

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

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

发布评论

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

评论(1

笑叹一世浮沉 2024-10-01 04:52:11

我不知道这是否有效,因为我从未尝试过,但我认为可能会。

首先对 MKMapView 进行子类化。然后,覆盖所有触摸处理程序(例如,touchesBegan:withEvent:、touchesEnded:withEvent: 等)。在重写的触摸处理程序中,对地图视图上显示的当前区域进行边界检查。如果它位于(或者可能非常接近)您想要显示的区域的边缘,则不要对触摸事件执行任何操作。否则,只需将触摸事件传递给该方法的超类实现。

如果这有效,请告诉我。

I don't know if this will work as I have never tried it, but I think it might.

Start by subclassing the MKMapView. Then, override all the touch handlers (e.g. touchesBegan:withEvent:, touchesEnded:withEvent:, etc...). In the overridden touch handlers do a bounds check on the current region being displayed on the mapview. If it is at (or maybe really close) to the edge of the area you want to show, then don't do anything with the touch event. Otherwise, just pass the touch event to the super classes implementation of the method.

If this works, let me know.

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