2011-07-07 71 views
0

信息窗口在桌面上顯示ok,如果我設置了一個提醒來顯示內容,它將顯示正確的HTML代碼。但是,在iPhone上它只會彈出一個空白信息窗口(其中沒有文字)。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 
       }); 



      }); 

     }); 
    } 

任何人都收到這個問題?我正在瘋狂地找出問題所在的位置。

+0

嘿,我有同樣的問題,你有沒有找到解決這個問題?我能夠在iphone的Safari瀏覽器中加載它,所以我猜這是UIWebview中的一些設置,只是不知道要改變什麼。 – MikeIsrael

回答

0

好的我終於能夠解決我的問題,但不知道它是否會幫助你。你使用的是loadHTMLString方法嗎?如果是這樣,你沒有聲明baseURL嘗試在通話中聲明

baseURL:[NSURL URLWithString:@"/"]