gpt4 book ai didi

iphone - iPad/iPhone 上的 Bing map

转载 作者:行者123 更新时间:2023-12-03 19:40:03 24 4
gpt4 key购买 nike

如何在 iPad 或 iPhone 业务应用程序上集成 bing map ?

有人可以帮我吗?

最佳答案

我编写了一个从 BING Api 到 ObjectiveC 的 javascript 包装器
这不是最好的解决方案,但它确实有效。

Objective-C offfer a method to call directly javascript from your code.

You can use stringByEvaluatingJavaScriptFromString from your UIWebView to call all of the js functions (zoom in, setmapType, etc...).

Your UIWebView must be a html page that contains a basic map.

像这样:

<!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>

Bing 引用 ( http://www.microsoft.com/maps/isdk/ajax/ )

一天后您可以达到以下结果:

http://www.albertopasca.it/whiletrue/2010/10/iphone-microsoft-bing-map-iphone-ipad/

这是一个包装 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();"];
}

您可以使用触摸手势以及......更多!

希望这有帮助!

阿尔贝托.

关于iphone - iPad/iPhone 上的 Bing map ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5229459/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com