Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

IOS Camera Overlay not showing when defined in xml file

$
0
0

Hi guys!

During my work with camera overlay I found one annoying bug I cant find workaround for. My Titanium SDK version is 3.4.1 and I am testing it on all devices (multiple android phones & tablets, iphones and iPad Mini), but the issue only appears to happen in IOS. So here is what my app looks like:

  1. I created a simple Alloy mobile app with 2 pages called index and camWindow. Index page only holds one button that loads camWindow. This functionality is extremely simple and can be omitted here as it has nothing to do with the bug.

  2. In camWindow.xml I create a View with id= "overlay". In camWindow.js I call $.camWindow.open() and upon opening the window I call Titanium.Media.showCamera. Here is the full code for this expression :

    Titanium.Media.showCamera({
        success:function(event) {
            // called when media returned from the camera
            if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
                //photo taken
            } 
        },
        cancel:function() {
            // called when user cancels taking a picture
             Titanium.Media.hideCamera();
        },
        error:function(error) {
            // called when there's an error
            alert("Something went wrong");
        },
        saveToPhotoGallery:false,
        mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO],
        animated:true,
        autorotate:false,
        overlay:$.overlay
        //showControls:false
    });
    3. When camera is show there is no overlay to be seen. When I close camera window I can see overlay being rendered in camWindow.js. I also noticed if I define overlay in camWindow.js and add it there then overlay is visible and works the way it supposed to. Again, this problem only appears on IOS.

Is there any way to solve this issue? Many could argue that I should just write Javascript code and forget about it, but I believe that defining overlay and styling it in respective xml and tss files makes code much cleaner and easier to manage in large application that I intend to build with Appcelerator.


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>