我正在尝试根据“更改”事件将imageview更改为新图像。当我用当前代码尝试此事件时,我得到一个错误 - “无效的图像类型。期望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();
这样看似乎很容易,但我很难过。 任何帮助表示赞赏。
答案 0 :(得分:0)
使用View
代替imageView
并设置backgroundImage
。