Phonegap - ios - 谷歌地图无法正确加载

时间:2013-10-09 09:17:14

标签: javascript ios google-maps cordova

Google Maps not load correctly

Xcode,ios,phonegap 2.9和此代码......无法正常工作。我需要帮助。在桌面浏览器中正常工作(safari,opera,firefox,explorer ...)。

我的代码......

头标签中的

......

<script src="cordova.js"></script>
        <script src="scripts/jquery.min.js"></script>
        <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
        <script>
        $(document).ready(function(){
        $('.mapaEvento').live('click', function(e){
        e.preventDefault();
        /*$('#status').fadeIn('fast');
        $('#preloader').fadeIn('fast');*/
        //cogemos la dirección
        var direccion = $(this).attr('rel');
        //creamos objeto googlemaps y a hacemos la consulta a google a partir de la dirección
        var geocoder = new google.maps.Geocoder();
        geocoder.geocode({ 'address': direccion}, resultadoGeocode);

        function resultadoGeocode(results, status) {
            // Verificamos el estatus
            if (status == 'OK') {
                var longitud = results[0].geometry.location.lng();
                var latitud = results[0].geometry.location.lat();

            //pintamos el mapa
                var mapaOpciones = {
                    zoom: 14,
                    center: new google.maps.LatLng(latitud, longitud),
                    mapTypeId: google.maps.MapTypeId.ROADMAP,
                    backgroundColor: '#ffffff',
                    noClear: true,
                    disableDefaultUI: true,
                    keyboardShortcuts: false,
                    disableDoubleClickZoom: false,
                    draggable:true,
                    scrollwheel: false,
                    draggableCursor: 'pointer',
                    draggingCursor: 'crosshair',
                    mapTypeControl: true,
                    mapTypeControlOptions: {
                        style: google.maps.MapTypeControlStyle.HORIZONTAL_MENU,
                        position: google.maps.ControlPosition.TOP_LEFT,
                        mapTypeIds: [
                            google.maps.MapTypeId.ROADMAP
                        ]
                    },
                    navigationControl: false,
                    streetViewControl: true,
                    navigationControlOptions:{
                        position: google.maps.ControlPosition.TOP_LEFT,
                        style: google.maps.NavigationControlStyle.ANDROID
                    },
                    scaleControl: true,
                    scaleControlOptions: {
                        position: google.maps.ControlPosition.TOP_LEFT,
                        style: google.maps.ScaleControlStyle.DEFAULT
                    }
                };

                var map = new google.maps.Map(document.getElementById('mapa'), mapaOpciones);

                var pinxo1 = new google.maps.Marker({
                    position: new google.maps.LatLng(latitud, longitud),
                    map: map,
                    animation: google.maps.Animation.BOUNCE,
                    title: 'MARKER',
                    icon: 'http://url.com/marker.png',
                    cursor: 'default',
                    draggable: false
                });

            $('#modal-mapa').fadeIn('fast');

            } else {
                alert("No se ha encontrado la dirección :( " + status);
            }
        }

    });
   }
   </script>

在体内...

<div id="modal-mapa">
<div class="header-modal">
    <a href="#" id="modal-mapa-cerrar" class="close-sidebar-right"></a>
    <a href="#" class="top-logo-modal"><img src="images/misc/logo.png" class="replace-2x" width="125" alt="img"></a>
</div>
<div id="mapa">

</div>

在xcode中,这是我的外部主机......

external hosts in xcode

谷歌地图界面工作正常,但没有显示地图制图。

谢谢大家;)

0 个答案:

没有答案