GoogleMap(Google maps V3 JS)
을 UIWebView(ios6)
에 표시하려고합니다.
그러나,
웹 뷰에서지도를 움직이면 이벤트가 발생하지 않습니다. center_changed
.
이동 맵 이동이 완료되었습니다. 이벤트가 실행됩니다.
왜? 화재 center_changed
맵이 이동하는 동안 - 맥 'Safri 액세스 http://gmaps-samples-v3.googlecode.com/svn/trunk/map_events/map_events.html
:
...
누군가가 나에게 페이지를 말했다.
iOS6 사 프리 접근 - 이동지도가 완료되었습니다 (화재 center_changed
).
...
이동할 때지도의 중심 - 좌표를 알고 싶습니다.
제발 잘 말해줘.
Google지도 V3 JS는 UIWebView iOS6 (iPhone)에서 "center_changed"가 발생하지 않습니다.
`<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>`
지도가 움직일 때 드래그가 실행되는 동안 위도와 경도가 업데이트되지 않고 실제로 드래그 작업이 시작될 때의 값이므로 – Zubair
@Zubair : 이것은 분명히 작동하는 데 사용되지만, 다시 올리면 더 이상 업데이트되지 않습니다. 여기 피들보기 http://jsfiddle.net/lazd/ReLf7/ – lazd