Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1601] iOS: Orientation change event occurs before rotation on landscape->portrait

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2012-09-05T18:57:46.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sn/a
ComponentsiOS
Labelsapi
ReporterThomas Huelbert
AssigneeBlain Hamon
Created2011-04-15T02:57:06.000+0000
Updated2017-03-22T20:51:33.000+0000

Description

from community,
1.using the provided code create an iPad or iPhone app
2.starting in landscape mode, slowly rotate

results:before the app UI changes over to portrait, the screen changes to white, meaning the orientation change handler fired prior to the actual event.


var mainWin = Ti.UI.createWindow({//url:"main.js",

                              title:'Decks',
                              barColor:"#333",
                              tabBarHidden: true
                              });

var decksTab = Ti.UI.createTab({title: "Decks", window: mainWin});
var tabGroup = Titanium.UI.createTabGroup({});
tabGroup.addTab(decksTab);
mainWin.tab = decksTab;
mainWin.tabGroup = tabGroup;
tabGroup.open();

mainWin.orientationModes = [

Titanium.UI.PORTRAIT,
Titanium.UI.LANDSCAPE_LEFT,
Titanium.UI.LANDSCAPE_RIGHT

];

Ti.Gesture.addEventListener(

'orientationchange', function(e) {
    if (e.orientation == Titanium.UI.LANDSCAPE_LEFT ||
        e.orientation == Titanium.UI.LANDSCAPE_RIGHT) {
        mainWin.backgroundColor = "#fff";
    } else {
        mainWin.backgroundColor = "#000";
    }
});

Comments

  1. Damien Elmes 2011-04-15

    Any chance of this getting into 1.6? On the main screen of my app I had a background image behind a tableview. If I take no action, the image gets squished to fit into landscape mode, so I had to create a separate image for landscape, and set that image when the orientation event fires. But because of this bug, when the user is holding the device at certain angles the image rapidly flips back and forth between portrait and landscape versions, despite the screen not rotating, and it looks pretty unprofessional (and many users don't connect it with an orientation problem). For the latest release of my app I had to replace the background image with a plain colour to avoid this problem, but now I have users asking me why I took away the image, and asking for it back.

  2. Alan Leard 2011-04-15

    An additional ticket reference: http://developer.appcelerator.com/helpdesk/view/67381">http://developer.appcelerator.com/helpdesk/view/67381

    Also an issue when tilting the iPhone of iPad away from the user.

  3. Damien Elmes 2011-04-15

    Original helpdesk ticket was http://developer.appcelerator.com/helpdesk/view/36731">http://developer.appcelerator.com/helpdesk/view/36731

  4. Sindre Sorhus 2011-10-19

    I've noticed it while developing my new app. Extremely annoying, and makes it unusable, since the rotation logic is expensive, and because of this bug, it is fired multiple times even though the devices isn't rotated. I ran the issues testcase compiled with Ti 1.7.3 on an iPad running iOS 5, and the issue is still there. Please fix!
  5. Wilson Luu 2011-10-31

    Bug is still valid, occurs in: TiMOB sdk version: 1.7.4, 1.8.0.v20111028154620 Studio version: 1.0.6.201110251616 OS version: Mac OS X Lion Devices tested on: ipad 4.3.5, iphone 5.0 Note: Bug is more prominent if the device is in landscape orientation and you tilt (pitch axis) the device back and forth.
  6. Junaid Younus 2012-08-15

    Issue seems to be reproducible using an iPhone 3GS with TiSDK 2.2.0v20120814103312.
  7. Blain Hamon 2012-09-05

    Ti.Gesture.orientationchange is an event triggered by the hardware accelerometer, and does not reflect the window's orientation. Watch TIMOB-10790 for the new event to listen for.
  8. Lee Morris 2017-03-22

    Closing ticket as invalid with reference to the above comments.

JSON Source