Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10353] iOS: isPortrait() returns incorrect value when app is started with iPad flat and in portrait mode

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2012-08-27T16:39:54.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterFederico Casali
AssigneeVishal Duggal
Created2012-07-03T07:50:35.000+0000
Updated2017-03-09T23:12:06.000+0000

Description

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();

Comments

  1. Blain Hamon 2012-08-27

    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.
  2. Lee Morris 2017-03-09

    Closing ticket as invalid.

JSON Source