开发者

Appcelerator Titanium tableView

开发者 https://www.devze.com 2023-04-06 12:31 出处:网络
I have a problem with tableView, specifically when I use a valid url as data for leftImage. It works like a charm if I use a local file, but not with any valid URL.

I have a problem with tableView, specifically when I use a valid url as data for leftImage.

It works like a charm if I use a local file, but not with any valid URL. Can anyone help me with this and tell me wha开发者_StackOverflowt I am doing wrong, and how it could be fixed so that I can display a jpg from a remote server?

P.S. Below is the related Titanium code. I am using Titanium Mobile 1.7.2 in Titanium Studio

 //...
    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);
    //...


I think that you might need to encode that URL, this character "~" might be causing some problems


i have no idea if remote images in leftimage properties are valid but you could do it like

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

精彩评论

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