OptionDialog orientation
Hi,
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?
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]];
to:
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'], cancel:2, landscape:true });
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. 1.5.1.1) and then edit that and build against the new SDK….just a thought.
-
A ticket has been opened for this at #2737. Watch it to keep up to date about its status.
-
Don't have a solution, but I have the exact same problem. Really annoying.
-
This is still a problem today. Is there a ticket yet to address this issue?
-
Has anyone managed to solve this yet? Still seems to be an issue with the latest builds.
-
I got the same problem. In 1.4.2 and iOS 4.1
-
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.
-
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.