【问题标题】:Appcelerator Titanium tableViewAppcelerator Titanium tableView
【发布时间】:2011-11-20 13:53:45
【问题描述】:

tableView 有问题,特别是当我使用有效的 url 作为 leftImage 的数据时。

如果我使用本地文件而不是任何有效的 URL,它就像一个魅力。 谁能帮我解决这个问题并告诉我我做错了什么,以及如何修复它以便我可以显示来自远程服务器的 jpg?

附:下面是相关的 Titanium 代码。我在 Titanium Studio 中使用 Titanium Mobile 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);
    //...

【问题讨论】:

    标签: javascript titanium appcelerator


    【解决方案1】:

    我认为您可能需要对该 URL 进行编码,这个字符“~”可能会导致一些问题

    【讨论】:

      【解决方案2】:

      我不知道 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
      });
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-08-02
        • 1970-01-01
        • 1970-01-01
        • 2020-10-06
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多