title: xcode iOS6 orientation landscape
body: <p>I see a lot of questions about this subject but am unable to find a solution to the problem I am experiencing. I have created an iPad app that should be Landscape only - it works fine when ran on any os prior to iOS6 but on iOS6 the app opens in portrait view. This screenshot shows what I mean (sorry not a great explanation) <a href="http://s1342.beta.photobucket.com/user/designedbyria/media/ScreenShot2012-11-02at122113.png.html" rel="nofollow noreferrer">http://s1342.beta.photobucket.com/user/designedbyria/media/ScreenShot2012-11-02at122113.png.html</a> </p>
  
  <p>I'm guessing the problem is somewhere in the below code, but I can't be sure. I have set the supported Interface Orientations to Landscape Left and Landscape Right only - but this has not worked. I have also taken a look at the questions here with no luck..</p>
  
  <p>I am using xcode and cordova/phonegap</p>
  
  <p><a href="https://stackoverflow.com/questions/12404556/interface-orientation-in-ios-6-0">Interface orientation in iOS 6.0</a></p>
  
  <p><a href="https://stackoverflow.com/questions/12600082/set-orientation-to-landscape-mode-in-xcode-4-5-gm-ios-6">Set orientation to landscape mode in xcode 4.5 GM IOS 6</a></p>
  
  <p><a href="https://stackoverflow.com/questions/12396545/ios-6-apps-how-to-deal-with-iphone-5-screen-size/12397738#12397738">iOS 6 apps - how to deal with iPhone 5 screen size?</a></p>
  
  <p>Thanks in Advance!</p>
  
  <blockquote>
    <blockquote>
      <p>/**
           * This is main kick off after the app inits, the views and Settings are setup here.     (preferred - iOS4 and up)
           <em>/
         - (BOOL) application:(UIApplication</em>)application didFinishLaunchingWithOptions:    (NSDictionary*)launchOptions {<br>
          NSURL* url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
          NSString* invokeString = nil;</p>
    </blockquote>
  
  <pre><code>if (url &amp;&amp; [url isKindOfClass:[NSURL class]]) {
      invokeString = [url absoluteString];      NSLog(@"iwill launchOptions = %@", url);
  }    
  
  CGRect screenBounds = [[UIScreen mainScreen] bounds];
  self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease];
  self.window.autoresizesSubviews = YES;
  
  CGRect viewBounds = [[UIScreen mainScreen] applicationFrame];
  
  self.viewController = [[[MainViewController alloc] init] autorelease];
  self.viewController.useSplashScreen = YES;
  self.viewController.wwwFolderName = @"www";
  self.viewController.startPage = @"index.html";
  self.viewController.invokeString = invokeString;
  self.viewController.view.frame = viewBounds;
  
  // check whether the current orientation is supported: if it is, keep it, rather than forcing a rotation
  BOOL forceStartupRotation = YES;
  UIDeviceOrientation curDevOrientation = [[UIDevice currentDevice] orientation];
  
  
  if (UIDeviceOrientationUnknown == UIInterfaceOrientationLandscapeLeft) {
      // UIDevice isn't firing orientation notifications yet… go look at the status bar
      curDevOrientation = (UIDeviceOrientation)[[UIApplication sharedApplication] statusBarOrientation];
  }
  
  if (UIDeviceOrientationIsValidInterfaceOrientation(curDevOrientation)) {
      for (NSNumber *orient in self.viewController.supportedOrientations) {
          if ([orient intValue] == curDevOrientation) {
              forceStartupRotation = YES;
              break;
          }
      }
  } 
  
  if (forceStartupRotation) {
      NSLog(@"supportedOrientations: %@", self.viewController.supportedOrientations);
      // The first item in the supportedOrientations array is the start orientation (guaranteed to be at least Portrait)
      UIInterfaceOrientation newOrient = [[self.viewController.supportedOrientations objectAtIndex:0]
  </code></pre>
    
    <p>intValue];
            NSLog(@"AppDelegate forcing status bar to: %d from: %d", newOrient, curDevOrientation);
            [[UIApplication sharedApplication] setStatusBarOrientation:newOrient];</p>
  
  <pre><code>}
  
  
  [self.window addSubview:self.viewController.view];
  [self.window makeKeyAndVisible];
  
  return YES; }
  </code></pre>
  </blockquote>