PhoneGap 및 jQueryMobile을 사용하여 iPhone 응용 프로그램을 개발하고 있습니다. 두 개의 html 페이지가 있는데 두 번째 html 페이지가 있으며 두 번째는 map.html입니다. 두 번째는 mapView.html입니다. index.html에서 mapView.html 열기지도보기가 PhoneGap과 함께로드되지 않습니다.
function loadMap() {
$.mobile.changePage("mapView.html", { transition: "pop"});
}
지도가로드되지 않습니다. 모든 브라우저에서 mapView.html을 열면 완벽하게 작동합니다. 심지어 직접 mapView.html을로드하여 변경하더라도
self.viewController.startPage = @"mapView.html";
의 appDelegate 클래스 맵에로드됩니다. 다른 .html 페이지에서 맵을 열면 맵이로드되지 않는 이유는 누구입니까? 내 PhoneGap 버전은 2.0.0입니다.
고마워요.
EDIT 1 mapView.html 코드
<!DOCTYPE HTML>
<html>
<head>
<title>Map Location</title>
<link rel="stylesheet" href="jquery.mobile-1.1.1.min.css" />
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="jquery.mobile-1.1.1.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3&sensor=false&language=en"> </script>
<script type="text/javascript">
var demoCenter = new google.maps.LatLng(41,-87);
var map;
function initialize()
{
map = new google.maps.Map(document.getElementById('map_canvas'), {
zoom: 7,
center: demoCenter,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
}
function addMarkers()
{
// perform your AJAX here. In this example the markers are loaded through the cityList array
$.ajax({
type:'post',
url:'test.html',
data:'',
success:function(data)
{
// imagine that the data in this list
// will be retrieved from the AJAX response
// i used the cityList array just for testing
var cityList = [
['Chicago', 41.850033, -87.6500523, 1],
['Illinois', 40.797177,-89.406738, 2]
];
var marker, i;
var infowindow = new google.maps.InfoWindow();
for (i = 0; i < cityList.length; i++)
{
marker = new google.maps.Marker({
position: new google.maps.LatLng(cityList[i][1], cityList[i][2]),
map: map,
title: cityList[i][0]
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(cityList[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
}
});
}
$(document).ready(function()
{
addMarkers();
});
</script>
</head>
<body onload="initialize()">
<div id="basic-map" data-role="page">
<div data-role="header" data-theme="b">
<h1>Map Location</h1>
<a data-rel="back">Back</a>
</div>
<div data-role="content">
<div class="ui-bar-c ui-corner-all ui-shadow" style="padding:1em;">
<div id="map_canvas" style="height:350px;"></div>
</div>
</div>
</div>
</body>
</html>
지도를로드하는 mapView.html에 코드를 표시해야합니다. –
지도 페이지의 코드와 전환 코드를 게시 할 수 있다면 디버깅에 많은 도움이됩니다. –