Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

OptionDialog orientation


I'm currently developing an app which is completely in landscape orientation.
When adding an OptionDialog, it appears as if the app is in portrait mode. Is there anyway to make it appear in landscape mode?

— asked April 29th 2010 by Felix van Geuns
  • landscape
  • optiondialog
  • orientation

8 Answers

  • This is still a bug in 1.5.1, however I have a "hackerific" fix!

    In the iPhone Classes for 1.5.1 I edited TiUIOptionDialogProxy.m at line 74 from:

    [actionSheet showInView:[[TiApp app] window]];


    UIView *landscapeView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 480, 480)];
    landscapeView.transform = CGAffineTransformMakeRotation((-1)*M_PI/2);
    landscapeView.bounds = CGRectMake(0, 80, 480, 320);
    BOOL landscape = [TiUtils boolValue:[self valueForKey:@"landscape"]];
    if(landscape) {
        [actionSheet showInView:landscapeView];
    } else {
        [actionSheet showInView:[[TiApp app] window]];

    Then in my Titanium JavaScript I can do:

    var dialog = Titanium.UI.createOptionDialog({
        options:['Option 1','Option 2', 'Cancel'],

    Don't forget: you'll need to delete your applications iphone build folder to pull in the new change.

    Ps. Sometimes you may want to copy the whole SDK, rename (eg. and then edit that and build against the new SDK….just a thought.

    — answered January 6th 2011 by Roger Chapman
    • This fix will be in 1.6 (About to make the commit to the repository), but if you already have this hack in, there's a simpler way.

      [actionSheet showInView:[[[TiApp app] controller] view]];

      The root controller view gets the rotation and such, not the app window, which is why the oddity. Hope this helps.

      — commented January 18th 2011 by Blain Hamon
    • Stupid question perhaps, but where can I find this file to edit it?

      — commented January 19th 2011 by Ted Sundin
    • You'll find it at "/Library/Application Support/Titanium/mobilesdk/osx/1.5.1/iphone/Classes", exchanging 1.5.1 for the SDK as needed. After you change it here, you need to clear out the contents of build/iphone in your project to trigger Titanium to re-generate the project from the template. This is an unsupported mod, etc, etc, but if it works, it works.

      — commented January 21st 2011 by Blain Hamon
    • And when will be 1.6 released?


      — commented January 23rd 2011 by Felix Krause
  • A ticket has been opened for this at #2737. Watch it to keep up to date about its status.

    — answered January 6th 2011 by Paul Dowsett
    • In answer to your question about when 1.6 will be released, see its Milestones page in lighthouse.

      — commented January 23rd 2011 by Paul Dowsett
    • In the 1.6 builds, the problems seems fixed but only when opening windows in a tabbar.
      Once i open a Modal window, the options Dialog is Portrait again.

      — commented January 24th 2011 by David P.
    • Yes! It doesn't really work on 1.6 either.

      Does anybody know, if Apple will accept apps with this orientation bug?

      — commented January 24th 2011 by Felix Krause
  • Don't have a solution, but I have the exact same problem. Really annoying.

    — answered April 29th 2010 by Sindre Sorhus
  • This is still a problem today. Is there a ticket yet to address this issue?

    — answered June 21st 2010 by Vinh Bui
  • Has anyone managed to solve this yet? Still seems to be an issue with the latest builds.

    — answered September 25th 2010 by Paul Hudson
  • I got the same problem. In 1.4.2 and iOS 4.1

    — answered October 28th 2010 by Sam Wong
  • Yep, pretty glaring bug. This ought to be pretty high on the list of priority fixes. It's these types of things that are unacceptable if Titanium wants seriously compete with native Objective-C apps, because as of right now, my app looks unprofessional with the dialog opening 'sideways' in landscape, and there's nothing I can do about it.

    — answered November 23rd 2010 by Bill Labus
  • Have you filed a bug report at https://appcelerator.lighthouseapp.com/dashboard

    As a workaround, could you use an alert dialog with a set of buttons? Not the same UI metaphor I realize. But if you have just a couple of options maybe it could work.

    — answered November 23rd 2010 by Tim Poulsen
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.