开发者

iPhone showing a blank infoWindow fro google maps

The info window shows ok on desktop, and if I set an alert to show the content it will show the correct html code. However, on the iPhone it will just pop a blank info window (No text within it).

Here is my code:

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
                });



            });

开发者_运维百科        });
    }

Anyone had this problem before? I'm going nutts to find out where the problem could be located.


OK I finally was able to solve my issue but not sure if it will help you. Are you using loadHTMLString method? if so and you aren't declaring a baseURL try declaring in the call

baseURL:[NSURL URLWithString:@"/"]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜