【发布时间】:2013-11-17 14:53:22
【问题描述】:
环境:iOS 7.0.3 和 6.1.3,在 iPhone 设备(几个单独的设备)上测试。 Ti v 3.1.3 与合金 1.2.2。
在设备上拍照时,我的应用卡住了。从图库中选择照片没有问题,但是在拍照时,应用程序会在移动和缩放屏幕上冻结 - 似乎是在点击“使用”按钮后。我的代码如下:
$.avatar.addEventListener("click", function() {
var opts = {
cancel : 2,
options : ['Take a Photo', 'Select from Gallery', 'Cancel'],
selectedIndex : 2,
destructive : 0,
title : 'Set a Profile Photo:'
};
var dialog = Ti.UI.createOptionDialog(opts);
dialog.show();
dialog.addEventListener("click", function(e) {
switch(e.index) {
case(0):
Titanium.Media.showCamera({
allowEditing : true,
success : function(event) {
$.avatar.status = "new";
$.avatar.image = event.media;
},
error : function(event) {
console.log(event);
}
});
case(1):
Titanium.Media.openPhotoGallery({
allowEditing : true,
success : function(event) {
$.avatar.status = "new";
$.avatar.image = event.media;
},
error : function(event) {
console.log(event);
}
});
}
});
});
此处所需的行为是用户点击他们的头像,这会打开选项菜单。然后他们点击“拍照”,这会打开相机,让他们拍照并裁剪。点击“使用”后,该照片会显示在 $.avatar ImageView 中。
我已经能够在我测试过的每台设备上跨多个 iOS 版本重现这一点。这是 Alloy 或 TI 中的错误,还是我在这里做错了什么? 谢谢!
【问题讨论】: