2011-09-19 101 views
0

我有一個tableView的問題,特別是當我使用有效的URL作爲leftImage的數據。 如果我使用本地文件,但它沒有任何有效的URL,它就像一個魅力。 任何人都可以幫助我,並告訴我我做錯了什麼,以及如何修復它,以便我可以從遠程服務器顯示jpg?
在此先感謝[email protected]Appcelerator鈦tableView

P.S.以下是相關的Titanium代碼。我使用的鈦移動1.7.2在鈦工作室

//... 
    var thisRow = Ti.UI.createTableViewRow({ 
    leftImage: "images/pix_sd_1.jpg",  // This works! 
    leftImage: "http://terminalentry.dyndns.org/~alex/pix/pix_sd_1.jpg", // this does not work! 

    layout:"vertical", 
    objectName:"RentalRow", 
    selectedColor:"black", 
    height:60 
    }); 
    thisRow.add(thisLabelCity); 
    thisRow.add(thisLabelState); 
    thisRow.add(thisLabelRentals); 
    thisRow.add(thisLabelTemp); 
    tableData.push(thisRow); 

    labelTempArray.push(thisLabelTemp); 
    //... 

回答

0

我不知道,如果在leftimage性能遠程圖像是有效的,但你可以做這樣

ti.ui.createTableViewRowWithLeftImage = function(_args){ 
    var leftImage = Ti.UI.createImage({ 
    left:4, 
    top:4, 
    height:20, 
    width:20, 
    url: _args.leftImage 
    }); 

    var row = Ti.UI.createTableViewRow(); 
    row.add(leftImage); 
    return row; 
} ; 

var myRow = ti.ui.createTableViewRowWithLeftImage({ 
    leftImage:http://terminalentry.dyndns.org/~alex/pix/pix_sd_1.jpg 
}); 
0

我認爲你可能需要編碼該URL,這個字符「〜」可能會導致一些問題