0

私はチタンを使用しており、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.');
4

1 に答える 1

0

showCamera は、実行コンテキストを停止しない非同期イベントです。画像のキャプチャの成功に関するアラートが必要な場合は、成功イベントにアラートを配置します。

http://developer.appcelerator.com/question/144053/showcamera-issue-on-ios#answer-250088 — Anthony Decena が 1 時間前に回答

于 2012-10-27T23:09:33.483 に答える