【问题标题】:Bing Map on the iPad/iPhoneiPad/iPhone 上的必应地图
【发布时间】:2013-12-10 15:38:07
【问题描述】:

如何在 iPad 或 iPhone 商务应用程序上集成必应地图?

谁能帮帮我?

【问题讨论】:

  • 我在 google 上找到了一篇关于此的帖子。 bing.com/community/site_blogs/b/maps/archive/2008/11/13/…你试过了吗?
  • 您有什么理由要这样做吗?您当然可以在谷歌地图客户端上叠加地图。我已经看到用 Open street map 完成了这项工作,没有看到 Bing,但理论上它应该可以工作!

标签: iphone ipad bing-maps


【解决方案1】:

我写了一个javascript wrapper 从 BING Api 到 ObjectiveC。
这不是最好的解决方案,但它有效。

Objective-C 提供一个方法调用 直接来自您的代码的 javascript

你可以使用 stringByEvaluatingJavaScriptFromString 从您的UIWebView 致电所有 js 函数(放大、setmapType、 ETC...)。

您的 UIWebView 必须是 html 页面 包含基本地图

像这样:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script>
      <script type="text/javascript">
         var map = null;

         function GetMap()
         {
            map = new VEMap('myMap');
            map.LoadMap(new VELatLong(45.46347, 9.19404), 10 ,'h' ,false);
            map.HideDashboard();
            map.SetMapStyle(VEMapStyle.Road);
            map.SetZoomLevel(10);
         }   
      </script>
   </head>
   <body onload="GetMap();">
      <div id='myMap' style="position:absolute; left:0px; top:0px; width:320px; height:460px;"></div>
   </body>
</html>

必应参考 (http://www.microsoft.com/maps/isdk/ajax/)

一天后你可以达到这个结果:

这里是一个包装好的 js 示例(其中map 是您的 html 页面上的一个 JS 变量!):

- (void) setZoom:(int)level {
    [self stringByEvaluatingJavaScriptFromString:@"map.setZoom(%d);", level]];
}
- (void) setCenterPoint:(NSString*)point {
    [self stringByEvaluatingJavaScriptFromString:[@"map.setCenterPoint(%@);", point]];
}
- (void) zoomIn {
    [self stringByEvaluatingJavaScriptFromString:@"map.zoomIn();"];
}
- (void) zoomOut {
    [self stringByEvaluatingJavaScriptFromString:@"map.zoomOut();"];
}

您可以使用触摸手势等等……更多!

希望这会有所帮助!

阿尔贝托。

【讨论】:

  • Paska,你如何在这张地图中绘制大头针,添加注释?
  • @Krishnan 我不记得了,但在这里你可以找到你找到的所有东西:microsoft.com/maps/isdk/ajax
  • 使用UIwebview时内存有问题吗?
  • 不,目前没有内存问题。
【解决方案2】:

Bing 地图现在有一个 iOS SDK,因此您可以在自己的 iOS 应用程序中本地使用它:

New Bing Maps iOS SDK

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-24
    • 1970-01-01
    相关资源
    最近更新 更多