Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google maps V3 JS no happen "center_changed" from UIWebView iOS6(iPhone)

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>`
like image 907
user1752923 Avatar asked Oct 18 '12 06:10

user1752923


1 Answers

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.

like image 62
yazz.com Avatar answered Oct 14 '22 01:10

yazz.com