Problem description
isPortrait() returns incorrect value when app is started with iPad flat and in portrait mode
Steps to reproduce and sample code
Put iPad into portrait mode and lay flat on a table.
Start the app (see sample code) and click on the button
isPortrait() returns false but Ti.UI.getOrientation() correctly returns Ti.UI.PORTRAIT
Sample code:
var win1 = Titanium.UI.createWindow({
backgroundColor:'white'
});
var portrait, orientation;
// Create a Button.
var button = Ti.UI.createButton({
title : 'Click',
height : 100,
width : 200,
top : 40
});
button.addEventListener('click', function(){
portrait = Ti.Gesture.isPortrait();
orientation = Ti.UI.getOrientation();
alert('isPortrait: ' + portrait + '--' + 'getOrientation: ' + orientation);
portrait = null;
orientation = null;
});
win1.add(button);
win1.open();
Ti.Gesture works on the physical device, not on the UI. When the device is flat on the table, Ti.Gesture.Orientation is "Face up". This is not portrait. Therefore, it returns false, as per design. Perhaps there should be a Ti.UI.isPortrait that actually reflects the UI orientation, not the device orientation. Marking as invalid.
Closing ticket as invalid.