Google maps iPhone中使用jQuery Mobile的空白谷歌地图
当我从listview在单页jQuery移动应用程序中加载一个页面时,我得到一个空白的google地图: 列表视图页面:Google maps iPhone中使用jQuery Mobile的空白谷歌地图,google-maps,jquery-mobile,Google Maps,Jquery Mobile,当我从listview在单页jQuery移动应用程序中加载一个页面时,我得到一个空白的google地图: 列表视图页面: <div data-role="page" id="addresses"> <div data-role="header" data-position="fixed"><h1>mobile</h1></div> <div class="ui-content" role="main">
<div data-role="page" id="addresses">
<div data-role="header" data-position="fixed"><h1>mobile</h1></div>
<div class="ui-content" role="main">
<ul data-role="listview">
<li><a href="" id="345" class="address">Paris</a></li>
<li><a href="" id="456" class="address">London</a></li>
</ul>
</div>
</div>
我在ripple模拟器中工作得很好,但在iPhone中它是这样的:
我发现了问题,使用iPhone上的应用程序访问控制台日志消息,我发现在iPhone中,来自MVC WebApi的纬度和经度被转换为错误的双精度格式来构建地图: 我必须从以下位置更改WebApi返回的模型:
public class MobileGetAddressDto
{
public int Id { get; set; }
public string Name { get; set; }
public double Latitude { get; set; }
public double Longitude { get; set; }
}
致:
问题解决了
$(document).on("pageshow", "#address", function ()
{
addressLoadMap();
});
function addressLoadMap()
{
var latitude = $("#latitude").val();
var longitude = $("#longitude").val();
var centerLatLng = new google.maps.LatLng(latitude, longitude);
var myOptions =
{
zoom: 16,
center: centerLatLng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl: false,
mapTypeControl: false
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var marker = new google.maps.Marker({
position: centerLatLng,
map: map
});
}
public class MobileGetAddressDto
{
public int Id { get; set; }
public string Name { get; set; }
public double Latitude { get; set; }
public double Longitude { get; set; }
}
public class MobileGetAddressDto
{
public int Id { get; set; }
public string Name { get; set; }
public string Latitude { get; set; }
public string Longitude { get; set; }
}