我想从 SQLite 中放置图像,但下面的代码不起作用:
var imageView = Ti.UI.createImageView({
image:services.fieldByName('image')
});
最佳答案
执行此操作可在保存之前将 blob 转换为字符串
var stringToSaveInDatabase = Ti.Utils.base64encode(thumbBlob).toString();
当您准备好将其添加到 View 时,请执行此操作
var imageBlob = Ti.Utils.base64decode(stringRetrievedFromDatabase);
Ti.UI.createImageView({ image:imageBlob });
http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.Utils-method-base64encode
关于titanium - 钛appcelerator View 中基于base64 的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17728845/