Auto Rotation in iOS 6

Discussion in 'iOS Programming' started by LastLine, Sep 13, 2012.

  1. LastLine macrumors 65816

    Aug 24, 2005
    Hey guys,

    I've been using this
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        return UIInterfaceOrientationIsLandscape(interfaceOrientation);
         [self prepareTapView];
        //     return NO;
    For the longest time to force a landscape orientation.

    Under the new iOS SDK it doesn't work and just sits in portrait - frustrating at best, crippling at worst. Can anyone suggest how I change this to fit the new guidelines? I've ben having real trouble with it.

    I've looked at the update notes but can't figure out what to do. Anyone able to help?
  2. xStep macrumors 68000

    Jan 28, 2003
    Less lost in L.A.
    I'm still looking closer at this one. Oddly, the simulator doesn't rotate with the 'old' code, but an iPad does.

    The trick seems to be the method used to set the root view controller for the apps window. A newer method needs to be used. Something like the following.

    [appDelegate.window setRootViewController: myVC];

    You _might_ have to do the following in some view controllers. I'm not sure it is required because, well long story and I'm still investing.

    - (BOOL)shouldAutorotate
        return YES;
    - (NSUInteger)supportedInterfaceOrientations
        return UIInterfaceOrientationMaskAll; // use what is appropriate for you.

Share This Page