我正在用钛做一个小的应用程序,我可以点击位于窗口中的“画廊”按钮,它就会打开相册。在选择照片时,它应该移动到下一个窗口。但它所做的是,它首先关闭图片库,然后我可以看到我的第一个(按钮)屏幕,然后它打开下一个窗口。
我不想让它显示前一个窗口。有办法做到吗??
我正在向选项卡添加窗口。下面是我的代码。
cameraButton.addEventListener('click',function(e){
chooseImageFromGallery();
});
function chooseImageFromGallery(){
var capturedImg;
//TODO Titanium.Media.showCamera({
Titanium.Media.openPhotoGallery({
success : function(event) {
capturedImg = event.media;
/* Condition to check the selected media */
if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
var window1 = MyWindows.init(capturedImg, docImgModel, previous_win);
MyCommon.addWindowToTabGroup(window1);
win.close();
}
},
cancel : function() {
//While cancellation of the process
activityInd.hide();
win.remove(activityInd);
},
error : function(error) {
/* called when there's an error */
var a = Titanium.UI.createAlertDialog({
titleid : 'camera'
});
if (error.code == Titanium.Media.NO_CAMERA) {
a.setMessage(L('camera_not_available'));
} else {
a.setMessage('Unexpected error: ' + error.message);
}
a.show();
activityInd.hide();
win.remove(activityInd);
}
});
}init方法只是创建一个新窗口并返回它。
addWindowToTabGroup方法将其添加到当前选项卡中
addWindowToTabGroup(window){
// tabGroup is a tab at global level declared in app.js
// activeTab returns the current tab
tabGroup.activeTab.open(window, {
animated : true
});
}非常感谢..。
发布于 2012-11-30 19:07:50
你可以这样做: 1-点击按钮,点击一个全局事件,这将打开你的相册,然后关闭你当前的窗口。
2-现在成功回调相册(当照片被选中时)编写代码打开你想要显示给你的用户的新窗口...
https://stackoverflow.com/questions/12928847
复制相似问题