Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8668] iPhone: OptionDialog has wrong rotation if displayed within a Modal Window and landscape orientation

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-05-01T15:49:24.000+0000
Affected Version/sn/a
Fix Version/sRelease 2.1.0, Sprint 2012-09 API
ComponentsiOS
Labelsapi, module_optiondialog, qe-testadded
ReporterMarkus Krug
AssigneeSabil Rahim
Created2012-04-10T13:19:24.000+0000
Updated2012-07-12T13:34:08.000+0000

Description

Problem

I think I found a bug in the OptionDialog. If one rotates an app to landscape, then opens a ModalWindow and there an OptionDialog. The OptionDialog is displayed centered and in portrait mode instead of landscape.

Test case

var win1 = Ti.UI.createWindow({orientationModes:[Titanium.UI.PORTRAIT, 
		Titanium.UI.UPSIDE_PORTRAIT, 
		Titanium.UI.LANDSCAPE_LEFT, 
		Titanium.UI.LANDSCAPE_RIGHT,]});
win1.open();
 
setTimeout(function() {
 
    var win    = Ti.UI.createWindow({title: 'MyApp'});
    var button = Ti.UI.createButton({title: 'open'});
 
    win.open({modal: true});
    win.add(button);
 
    button.addEventListener('click', function () {
 
        var dialog = Ti.UI.createOptionDialog({title: 'test', options: ['1', '2', '3']});
        dialog.show();
    });
 
}, 5000);
I just set a timeout cause you need a few seconds to rotate the device. All orientations are allowed in tiapp.xml

Steps to reproduce:

* Open app and rotate the iPhone or Simulator to landscape (cmd + left/right) while the window is black. * After 5 seconds it'll open a Modal Window with white background and a button. * Open the OptionDialog by pressing the 'open' Button.

Result:

The option dialog is centered and not correct displayed. See attached image.

Community Discussion

Q&A [iPhone: OptionDialog has wrong rotation if displayed within a Modal Window and landscape orientation](http://developer.appcelerator.com/question/134792/iphone-optiondialog-has-wrong-rotation-if-displayed-within-a-modal-window-and-landscape-orientation)

Attachments

FileDateSize
screenshot215d.png2012-04-10T13:19:24.000+000013533

Comments

  1. Sabil Rahim 2012-04-30

    adding orientationModes to the window correct the sample code
  2. Sabil Rahim 2012-04-30

    adding orientationModes to the window to correct the sample code
  3. Vishal Duggal 2012-04-30

    Pull pending https://github.com/appcelerator/titanium_mobile/pull/2104
  4. Blain Hamon 2012-05-01

    Pull merged.
  5. Tamila Smolich 2012-06-26

    Closing as fixed. Tested and verified with: Titanium Studio, build: 2.1.0.201206251749 Titanium SDK: 2.1.0.v20120626104306 Device: iPhone 4S (5.0.1), iPhone simulator

JSON Source