简体   繁体   English

谷歌地图和iPhone

[英]Google maps and iPhone

I'm developing simple application for smart phones. 我正在为智能手机开发简单的应用程序。 It works everywhere except iPhone. 它可以在iPhone以外的任何地方使用。 Code is dead simple: js: 代码非常简单:js:

var initial_lat  = 58.3972;
var initial_lng  = 15.5776;
var initial_zoom = 15;
var map;

function initialize_map() {
    var initialLatLng = new google.maps.LatLng(initial_lat, initial_lng);

    var myOptions = {
        zoom: initial_zoom,
        center: initialLatLng,
        mapTypeControl: true,
        mapTypeControlOptions: {
            style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
        },
        navigationControl: true,
        navigationControlOptions: {
            style: google.maps.NavigationControlStyle.BIG
        },
        mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("map_block"), myOptions);
}

and HTML: 和HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
        <script type="text/javascript" src="resources/js/test.js"></script>


    </head>
    <body onload="initialize_map()">
        <div id="map_block" style="width:100%; height:480px;" ></div>
    </body>
</html>

It displays a map and big navigation controller for moving map - nothing special. 它显示地图和用于移动地图的大型导航控制器-没什么特别的。 It works everywhere except for iPhone. 除了iPhone,它在任何地方都可以使用。 On iPhone, map is displayed correctly but you cant move it (drag and move) and the navigation controller(widget if you like) does not appear. 在iPhone上,地图可以正确显示,但是您不能移动它(拖动并移动),并且导航控制器(如果愿意的话,是小部件)也不会出现。

What am I missing? 我想念什么?

Have you tried activating debug errors on safari settings (at bottom). 您是否尝试过在Safari设置中激活调试错误(在底部)。 My be you have some error blocking the code. 我是您在阻止代码时遇到了一些错误。 Try with a small height in place of 480px. 尝试以较小的高度代替480px。 Cheers. 干杯。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM