钛-使用picker更改imageview

钛-使用picker更改imageview,image,mobile,replace,imageview,titanium,Image,Mobile,Replace,Imageview,Titanium,我正在尝试根据“更改”事件将imageview更改为新图像。当我用当前代码尝试此事件时,我得到一个错误-“无效的图像类型。应为TiBlob或TiFile,was:NSNull在-[TiUIImageView setImage:](TiUIImageView.m:693) 看起来这应该很容易做到,但我被难住了。 非常感谢您的帮助。请使用视图而不是图像视图并设置背景图像当您尝试设置背景图像而不是图像时会发生什么?背景图像也没有更改。我还使用了URL。我不知道您的图像路径是否正确,或者e.row.lo

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

看起来这应该很容易做到,但我被难住了。
非常感谢您的帮助。

请使用
视图
而不是
图像视图
并设置
背景图像

当您尝试设置
背景图像
而不是图像时会发生什么?背景图像也没有更改。我还使用了URL。我不知道您的图像路径是否正确,或者e.row.logo显示的路径是否正确。但是有一件事你可以尝试更多,那就是使用
View
而不是
imageView
,然后设置
backgroundImage
,然后看看会发生什么。穆罕默德,谢谢你!我把它改成了视图并更改了背景图像,效果很好!谢谢!
//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();