title: iOS 6 Rotation Bug: Window and Root View Controller frame does not change despite rotation
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2686882/incorrect-frame-window-size-after-re-orientation-in-iphone">“Incorrect” frame / window size after re-orientation in iPhone</a>  </p>
  </blockquote>
  
  
  
  <p>I'm trying to solve a very frustrating issue with an app of mine - in studying it I may have found a bug in iOS:</p>
  
  <p>When you rotate the iPad, the view rotates, but it's frame does not change.  I am running a timer that prints out the width and height of my view every second, and although I can see the view rotate visually, the frame remains "768x1024" no matter what.</p>
  
  <p>From Apple's docs:</p>
  
  <blockquote>
    <p>When the user interface rotates, the window is resized to match the new orientation. The window adjusts the frame of its root view controller to match the new size, and this size in turn is propagated down the view hierarchy to other views.</p>
  </blockquote>
  
  <p>This is exactly what isn't happening, and it's causing me all sorts of trouble.  Does anyone know how to fix rotation so that the frame changes?</p>
  
  <p>Steps to reproduce:</p>
  
  <ol>
  <li>Create a new empty project</li>
  <li>Add a bone stock UIViewController as the root view</li>
  <li>Set a timer to print out the root view controller's frame width and height</li>
  <li>Run your app, and rotate it all around.  Here's my code I'm testing with:</li>
  </ol>
  
  <pre>
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
      self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
      self.window.rootViewController = [[UIViewController alloc] init];
  
      NSLog(@"%fx%f", self.window.rootViewController.view.frame.size.width, self.window.rootViewController.view.frame.size.height);
  
      // Add a label to confirm orientation
      UILabel *orientationLabel = [[UILabel alloc] initWithFrame:CGRectMake(10,10,100,30)];
      orientationLabel.text = @"Top Left";
      [self.window.rootViewController.view addSubview: orientationLabel];
  
      [NSTimer scheduledTimerWithTimeInterval:.3 target:self selector:@selector(testScale) userInfo:nil repeats:YES];
  
      self.window.backgroundColor = [UIColor whiteColor];
      [self.window makeKeyAndVisible];
      return YES;
  }
  </pre>
  
  <pre>
  - (void) testScale {
      NSLog(@"%fx%f", self.window.rootViewController.view.frame.size.width, self.window.rootViewController.view.frame.size.height);
  }
  </pre>