title: iOS Orientation: Tried this and tried that
body: <p>The app will show stuff on a second display fine.  Issue is when I when I rotate the iPad the content doesn't rotate on the iPad.</p>
  
  <p>Have looked at:</p>
  
  <p><a href="http://developer.apple.com/library/ios/#qa/qa1688/_index.html" rel="nofollow noreferrer">http://developer.apple.com/library/ios/#qa/qa1688/_index.html</a><br>
  <a href="https://stackoverflow.com/questions/6116248/interface-orientation-wont-change-to-landscape-on-app-launch">Interface Orientation won&#39;t change to Landscape on App Launch</a><br>
  <a href="https://stackoverflow.com/questions/431165/iphone-sdk-orientation-landscape-and-portrait-views">iPhone SDK: Orientation (Landscape and Portrait views)</a><br>
  <a href="http://www.bytesizecreations.com/2009/05/working-with-orientation-changes-on/" rel="nofollow noreferrer">http://www.bytesizecreations.com/2009/05/working-with-orientation-changes-on/</a><br>
  <a href="https://stackoverflow.com/questions/402/iphone-app-in-landscape-mode">iPhone app in landscape mode, 2008 systems</a><br>
  <a href="https://stackoverflow.com/questions/402/iphone-app-in-landscape-mode">iPhone app in landscape mode, 2008 systems</a><br>
  <a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/7366-interface-builder-landscape-design.html#post186977" rel="nofollow noreferrer">http://www.iphonedevsdk.com/forum/iphone-sdk-development/7366-interface-builder-landscape-design.html#post186977</a>  </p>
  
  <p>Anyone who could tell me exactly what I need to add would be appreciated! :)</p>
  
  <pre><code>#import "iPadVGAOutputTestAppDelegate.h"
  
  @implementation iPadVGAOutputTestAppDelegate
  
  @synthesize deviceWindow;
  @synthesize consoleTextView;
  @synthesize externalWindow;
  
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
      // Overriden to allow any orientation.
      return YES;
  }
  
  
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
  
      externalWindow.hidden = YES;
  
  
      // Make iPad window visible.
      [deviceWindow makeKeyAndVisible];
  
      // Check for external screen.
      if ([[UIScreen screens] count] &gt; 1) {
          [self log:@"Found an external screen."];
  
          // Internal display is 0, external is 1.
          externalScreen = [[[UIScreen screens] objectAtIndex:1] retain];
          [self log:[NSString stringWithFormat:@"External screen: %@", externalScreen]];
  
          screenModes = [externalScreen.availableModes retain];
          [self log:[NSString stringWithFormat:@"Available modes: %@", screenModes]];
  
          // Allow user to choose from available screen-modes (pixel-sizes).
          UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"External Display Size" 
                                                           message:@"Choose a size for the external display." 
                                                          delegate:self 
                                                 cancelButtonTitle:nil 
                                                 otherButtonTitles:nil] autorelease];
          for (UIScreenMode *mode in screenModes) {
              CGSize modeScreenSize = mode.size;
              [alert addButtonWithTitle:[NSString stringWithFormat:@"%.0f x %.0f pixels", modeScreenSize.width, modeScreenSize.height]];
          }
          [alert show];
  
      } else {
          [self log:@"External screen not found."];
      }
  
      return YES;
  }
  
  
  - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
  {
      UIScreenMode *desiredMode = [screenModes objectAtIndex:buttonIndex];
      [self log:[NSString stringWithFormat:@"Setting mode: %@", desiredMode]];
      externalScreen.currentMode = desiredMode;
  
      [self log:@"Assigning externalWindow to externalScreen."];
      externalWindow.screen = externalScreen;
  
      [screenModes release];
      [externalScreen release];
  
      CGRect rect = CGRectZero;
      rect.size = desiredMode.size;
      externalWindow.frame = rect;
      externalWindow.clipsToBounds = YES;
  
      [self log:@"Displaying externalWindow on externalScreen."];
      externalWindow.hidden = NO;
      [externalWindow makeKeyAndVisible];
  }
  
  
  - (void)log:(NSString *)msg
  {
      [consoleTextView setText:[consoleTextView.text stringByAppendingString:[NSString stringWithFormat:@"%@\r\r", msg]]];
  }
  
  
  - (void)dealloc
  {
      [consoleTextView release];
      [deviceWindow release];
      [externalWindow release];
  
      [super dealloc];
  }
  
  
  @end
  </code></pre>