Orientation issue

You must Login before you can answer or comment on any questions.

Hello,

I have this code to arrange a scrollview content based on the orientation:

Titanium.Gesture.addEventListener('orientationchange', function (ev) {
            if (Titanium.Gesture.isLandscape(ev.orientation)) {
                //arrange content for landscape
            }else{
                //arrange content for portait
            }
 
    });
The problem is that this event is fired when I rotate the screen (lets say 45ยบ) and all content arrange but the app still no rotate (the app window), so all my content is for portait now and the app is still in landscape.

Let me know if I explain well mi issue or if I need to upload a video.

Thanks for your help

1 Answer

Accepted Answer

Instead of using the isLandscape() method, try this

if(e.orientation == 1 || e.orientation == 2) // do something
else if (e.orientation == 3 || e.orientation == 4) // do something
1 and 2 are for portrait and 3 and 4 are for landscape.

Your Answer

This question has been locked and cannot accept new answers.