iPhone显示谷歌地图的空白信息窗口

时间:2011-07-07 06:35:43

标签: iphone google-maps-api-3 web-applications

信息窗口在桌面上显示正常,如果我设置警报以显示内容,它将显示正确的html代码。但是,在iPhone上它只会弹出一个空白信息窗口(其中没有文字)。

这是我的代码:

function showPOICategory(category) {
        // Icons { ID, Image }
        // Entry { Latitude, Longitude, Name, Description, iconID);
        $.getJSON('ajax/poi.php?key=' + jQGMSettings.apiKey + '&c=' + category , function(data) {
            $.each(data.poi, function(key, val) {
                // Set current position marker
                var $image = new google.maps.MarkerImage('/images/pois/'+data.icons[val.image],
                    // This marker is 20 pixels wide by 32 pixels tall.
                    new google.maps.Size(32, 37),
                    // The origin for this image is 0,0.
                    new google.maps.Point(0,0),
                    // The anchor for this image is the base of the flagpole at 0,32.
                    new google.maps.Point(16, 37)
                );

                var $marker = new google.maps.Marker({
                    title: val.title,
                    icon: $image,
                    clickable: true,
                    draggable: false,
                    position: new google.maps.LatLng(val.latitude,  val.longitude), 
                    animation: google.maps.Animation.DROP,
                    map: map
                });

                // Info Window
                if( val.info == null ) {
                    var $infowindow = new google.maps.InfoWindow({
                        content: '<div><h1>' + val.title + '</h1>Prueba</div>'
                    });
                } else {
                    var $infowindow = new google.maps.InfoWindow({
                        content: '<div style="color:#000000;"><h1 style="font-size:14px; font-family:Helvetica; padding:0px; margin:0px;">' + val.title + '</h1>' + val.info + 'Prueba</div>',
                        maxWidth: 200
                    });
                }

                var $listener = google.maps.event.addListener($marker, 'click', function() {
                    if( infoWindow != null ) {
                        infoWindow.close();
                    }

                    infoWindow = $infowindow;
                    infoWindow.open(map,$marker);
                });

                // Keep track of the marker to remove it ;)
                pois.push({
                    marker: $marker,
                    listener: $listener
                });



            });

        });
    }

以前有人遇到过这个问题吗?我正在努力找出问题所在。

1 个答案:

答案 0 :(得分:0)

好的,我终于能够解决我的问题,但不确定它是否会对你有帮助。你在使用loadHTMLString方法吗?如果是这样,并且您没有声明baseURL尝试在通话中声明

baseURL:[NSURL URLWithString:@"/"]