title: When changing UIWindow subviews, orientation is not set
body: <p>If a view is added to the window, orientation is set as portrait even if the device is in landscape.
  If the view is added in the app delegate, application:didFinishLaunchingWithOptions: method, then it works correctly. But if the view is added later it does not.</p>
  
  <p>As an example, I have a routine to switch views. Simplest form is:</p>
  
  <pre><code>- (void)switchToNewViewController:(UIViewController *)newViewController { 
   if ([[window subviews]count]!=0) {
    [[[window subviews]objectAtIndex:0] removeFromSuperview];
   }
   [window addSubview:newViewController.view];
  }
  </code></pre>
  
  <p>IF this is called from within didFinishLaunching, orientation is correct. If it is not, orientation is portrait.</p>
  
  <p>Simplest case is within didFinishLaunching I have the following two lines</p>
  
  <pre><code>// The following line works
  [self switchToNewViewController:fullScreenViewController];
  
  // The following line which delays the method call until later results
  // in incorrect orientation 
  [self performSelector:@selector(switchToNewViewController:) withObject:fullScreenViewController afterDelay:0.1];
  </code></pre>
  
  <p>Is there a way to make the view have the proper orientation?</p>