【发布时间】:2015-05-07 08:33:23
【问题描述】:
所以我目前有一个带有视图 (id="newPhoto") 的窗口,我在其中放置了上一步中的图像。在这个 newPhoto-view 上,我通过 css 放置一个新视图(id="content"),上面有一个图标和一些文本。 然后我想将带有图像的父视图及其上的图标和文本作为新图像保存到 photoGallery。最简单的方法是什么?将所有内容放在一个视图中并保存新视图,还是截取所需部分并保存? 不能让它工作:(
我的 filterWindow.xml 文件:
<Alloy>
<Window id="filterWindow">
<View id="finalImage" />
<View id="selectedPhoto" />
<View id="counter">
<ImageView id="weatherIcon" />
<Label id="label" />
</View>
<Button id="filterAndSaveBtn" onClick="filterAndSave">Filter</Button>
</Window>
</Alloy>
我的 filterWindow.js:
var photo = Alloy.createController('photo').getView();
$.selectedPhoto.add(photo);
$.selectedPhoto.width = appWidth;
$.selectedPhoto.height = appWidth;
$.label.text = "Some text";
function filterAndSave(e) {
var blob = $.finalImage.toBlob();
Ti.Media.saveToPhotoGallery(blob,{
success: function(e){
alert('Saved image to gallery');
},
error: function(e){
alert("Error trying to save the image.");
}
});
}
提前感谢您查看这个!
【问题讨论】:
标签: ios image titanium appcelerator titanium-alloy