PDA

View Full Version : force landscape orientation




arnieterm
Jan 15, 2009, 05:12 AM
hi,

Does anybody know of a way to force landscape orientation for a view controller in an iPhone application?

I have defined a UI in Interface Builder that I want to always show in landscape mode.
When the app first starts though, it is always in Portrait Mode.

Once the orientation is changed to landscape it will never go back to Portrait since I have setup the shouldAutorotateToInterfaceOrientation method correctly, but I can't seem to figure out a way to start it out in landscape mode.
thanks in advance.

arnie



allbrokeup
Jan 15, 2009, 05:44 AM
Open up your App Delegate M file.

Put This:

application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;

Into the:

- (void)applicationDidFinishLaunching:(UIApplication *)application {

Method.

If you want the statusbar on the other side, just change UIInterfaceOrientationLandscapeRight to UIInterfaceOrientationLandscapeLeft.

allbrokeup