force landscape orientation

Discussion in 'iPhone/iPad Programming' started by arnieterm, Jan 15, 2009.

  1. macrumors regular

    Joined:
    Aug 28, 2008
    #1
    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
     
  2. macrumors 6502

    Joined:
    Mar 6, 2008
    Location:
    Melbourne, Australia
    #2
    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
     

Share This Page