MKMapView、Google 地图 API 和交通信息

发布于 2024-08-22 11:46:05 字数 556 浏览 9 评论 0原文

当您读完这个问题时,您会发现我对这一发展还很陌生。但我有一个简单的问题。我想我(不幸的是,有点)知道答案,但我想我还是会问:

我正在开发一个应用程序,我想在其中将 Google 地图的交通数据显示到地图中。看起来很容易。我可以轻松地将 MKMapView 放置在所需位置的中心。我还可以创建一个可以在浏览器上查看的自定义 Google Maps API,它会使用 GTrafficOverlay 对象显示流量数据。

现在...

我可以使用 API 流量数据(在 Javascript 中)并将其解析到 MKMapView 实现中吗?我不这么认为...对吧?

所以,我唯一的选择就是使用 UIWebView,对吗?我只是链接到该页面,然后就可以开始了。

另外...这样做有什么主要缺点吗?我知道我失去了一些内置界面,但除此之外,似乎并没有那么大的区别,对吧?

另外,如果我想使用 Google Code API,如何就地实现它?我是否必须将该 HTML 文件放在服务器中的某个位置,或者我可以将其作为我的资源的一部分,还是什么?

对于所有问题,我们深表歉意,但提前感谢大家提出的任何建议!

By the time you finish reading this question, it will become obvious to you that I'm pretty new to this development. But I've got a quick question here. I think I (unfortunately, sorta) know the answer, but I figured I'd ask, anyway:

I'm working on an app in which I'd like to display traffic data from Google Maps into a map. Easy enough, it seems. I can easily put the a MKMapView and center it on the desired location. I can also create a custom Google Maps API that I can look at on my browser, and it would display the traffic data with the GTrafficOverlay object.

Now...

Can I use the API traffic data (in Javascript) and parse it into the MKMapView implementation? I don't think so... right?

So, my only other option is to do a UIWebView instead, right? I just link to that page, and I'm good to go.

Also... Is there a major drawback to doing that? I know I lose a bit of the built-in interface, but beyond that, it doesn't seem to be that huge a difference, right?

And, also, if I want to use that Google Code API, how do I implement it in place? Do I have to have that HTML file somewhere in a server, or can I have it as part of my resources, or what?

Sorry about all the questions, but thanks in advance for any suggestions y'all might have!

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

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

发布评论

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

评论(1

一身软味 2024-08-29 11:46:05

您无法直接将 javascript 解析为 MKMapView 实现。

是的,您可以使用 UIWebView。我只简单地看了一下,默认行为非常令人讨厌,因为网络视图和地图视图都试图响应拖动事件等。可能有一种方法可以调整它 - 你会想要寻找 SDK2.x 示例,因为当时没有其他地图解决方案。

这篇文章还可能提供很多帮助。

You can't parse the javascript into the MKMapView implementation directly.

Yes you can use a UIWebView. I've only had a brief look at that, and it was pretty nasty with default behaviour, because both the web view and the map view try to respond to drag events etc. There is probably a way of tuning that out - you would want to look for SDK2.x examples as there was no other maps solution then.

This post may also provide a lot of help.

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