【发布时间】:2013-07-18 16:15:50
【问题描述】:
我想从 SQLite 放一张图片,但下面的代码不起作用:
var imageView = Ti.UI.createImageView({
image:services.fieldByName('image')
});
【问题讨论】:
标签: titanium base64 titanium-alloy
我想从 SQLite 放一张图片,但下面的代码不起作用:
var imageView = Ti.UI.createImageView({
image:services.fieldByName('image')
});
【问题讨论】:
标签: titanium base64 titanium-alloy
在保存之前将 blob 转换为字符串
var stringToSaveInDatabase = Ti.Utils.base64encode(thumbBlob).toString();
当您准备好将其添加到视图中时,请执行此操作
var imageBlob = Ti.Utils.base64decode(stringRetrievedFromDatabase);
Ti.UI.createImageView({ image:imageBlob });
http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.Utils-method-base64encode
【讨论】: