0

我正在尝试根据“更改”事件将图像视图更改为新图像。当我使用当前代码尝试此事件时,我得到一个错误-“无效的图像类型。预期 TiBlob 或 TiFile,是:NSNull in -[TiUIImageView setImage_:] (TiUIImageView.m:693)

//This label contains text that will change with each picker change
var results = Titanium.UI.createLabel({
text:"Select from the picker below",
height:40,
width:"auto",
top:20  
});

//This view contains an image that will change with each picker change
var imageView = Titanium.UI.createImageView({   
        image:"images/logos/CIK.jpg",
        height: 100, 
        width: 100, 
        left: 110,
        top: 80
    });

picker.addEventListener("change", function(e){
results.text = e.row.title + ": Home of the " + e.row.val;
imageView.image = e.row.logo; //logo contains a value like images/logos/BURRTON.jpg
});

win.add(results);
win.add(imageView);

win.open();

似乎这应该很容易做到,但我很难过。任何帮助表示赞赏。

4

1 回答 1

0

使用View代替imageView并设置一个backgroundImage.

于 2012-04-27T04:44:39.543 回答