谷歌地图V3 JS没有发生“center_changed”从UIWebView iOS6(iPhone) [英] Google maps V3 JS no happen "center_changed" from UIWebView iOS6(iPhone)

查看:135
本文介绍了谷歌地图V3 JS没有发生“center_changed”从UIWebView iOS6(iPhone)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在 UIWebView(ios6)中显示 GoogleMap(Google maps V3 JS)。 >
但是,

当我在webview中移动地图时,事件no fire center_changed

移动地图有已完成,事件发生。

为什么?

...

有人告诉我页面:

http://gmaps-samples-v3.googlecode.com/svn/trunk/map_events/map_events .html

Mac'Safri访问 - 在地图移动时触发 center_changed

iOS6 Safri访问 - 移动地图是完整的,fire center_changed



...

我想知道

I'm trying to display GoogleMap(Google maps V3 JS) in UIWebView(ios6).
but,
When I moveing the map in webview,event no fire center_changed.
Move map has been completed, event fire.
Why?
...
Someone told me page:
http://gmaps-samples-v3.googlecode.com/svn/trunk/map_events/map_events.html
Mac' Safri access - fire center_changed while the map is moving.
iOS6 Safri access - move map is complete, fire center_changed.

...
I want to know the Center-Cordinates of the map while moving.
Please tell me a good way.

`<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API v3 Example: iPhone Geolocation</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var map;
var moveCenterLat;
var moveCenterLng;

function initialize() {
    var myOptions = {
    zoom:reqZoomLevel,
    disableDefaultUI:true,
    draggable:true,
    keyboardShortcuts:false,
    scrollwheel:false,
    mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

google.maps.event.addListener(map, 'center_changed', function(){
    var mce = map.getCenter();
    moveCenterLat = mce.lat();
    moveCenterLng = mce.lng();
});

}
</script>
</head>
<body style="margin:0px; padding:0px;" onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>`


推荐答案

是在iOS设备上的谷歌地图上不起作用的东西。当地图被拖动时,center_changed会被触发,但中心不会更新,直到拖动完成。所以答案是'不',你不能这样做。

This is something that doesn't work on google maps on IOS devices. The center_changed is fired when the map is dragged but the center does not update until the drag is complete. So the answer is, 'no', you can not do this.

这篇关于谷歌地图V3 JS没有发生“center_changed”从UIWebView iOS6(iPhone)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆