我正在使用 Titanium 并在 iOS 上测试相机。我遇到了一个问题,即在我浏览相机页面之前运行相机页面之后的代码。在下面的代码中,该行在'alert('Picture uploaded successfully.')
相机屏幕甚至打开之前执行。有什么想法吗?
var wincam;
wincam = Titanium.UI.createWindow();
if (Ti.Platform.osname === 'android') {
win.addEventListener('open', function(e) {
});
} else {
Titanium.Media.showCamera({
success:function(event)
{
var cropRect = event.cropRect;
var image = event.media;
Ti.API.debug('Our type was: '+event.mediaType);
if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)
{
var imageView = Ti.UI.createImageView({
width:win.width,
height:win.height,
image:event.media
});
win.add(imageView);
}
else
{
alert("got the wrong type back ="+event.mediaType);
}
},
saveToPhotoGallery:false,
allowEditing:true,
mediaTypes:[Ti.Media.MEDIA_TYPE_VIDEO,Ti.Media.MEDIA_TYPE_PHOTO]
});
}
//open next page
var w3 = Titanium.UI.createWindow({
backgroundImage:'/images/5-survey.png'
});
w3.open();
alert('Picture uploaded successfully.');