Search code examples
iphoneiostitaniumappcelerator-mobile

Take multiple pictures using Titanium/Appcelerator on iPhone


I am working on a small iPhone app using Titanium/Appcelerator. Now what I am trying to do is the following:

  • Open the camera to take a picture
  • Ask the user if he wants to add another picture (OptionDialog)
  • Open the camera again
  • {loop here}
  • Put the images (saved locally) into an array

I tried putting a OptionDialog into the success event of the camera, but it didn't work as expected.


Solution

  • maybe something like that.

     dialog.addEventListener('click',function(e){
          switch (e.index){
             case 1:
              takeAPicture();
             case default:
               ...          
          };
     });
    
    function takeAPicture(){
    
      Titanium.Media.showCamera({
        success: function(evtSuccess) {
          dialog.show();    
        },
        ...
      });
    
    };
    Titanium.Media.takePicture();