force landscape orientation

Discussion in 'iOS Programming' started by arnieterm, Jan 15, 2009.

  1. arnieterm macrumors regular

    Aug 28, 2008

    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.

  2. allbrokeup macrumors 6502

    Mar 6, 2008
    Melbourne, Australia
    Open up your App Delegate M file.

    Put This:

    application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;

    Into the:

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


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


Share This Page