title: Easiest way to support multiple orientations? How do I load a custom NIB when the application is in Landscape?
body: <p>I have an application in which I would like to support multiple orientations. I have two .xib files that I want to use, myViewController.xib and <code>myViewControllerLandscape.xib. myViewController.xib</code> exists in project/Resources and <code>myViewControllerLandscape.xib</code> exists in the root project directory.</p>
  
  <p>What I want to do is use a separate NIB <code>(myViewControllerLandscape.xib)</code> for my rotations. I try detecting rotation in <code>viewDidLoad l</code>ike this:</p>
  
  <pre><code>if((self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight))
   {
    NSLog(@"Landscape detected!");
    [self initWithNibName:@"myViewControllerLandscape" bundle:nil];
  
   }
  </code></pre>
  
  <p>But I can see in gdb that this isn't executed when the app is started with the device in landscape. The NSLog message doesn't fire. Why is this? What have I done wrong?</p>
  
  <p>Also, if I explicitly put the <code>initWithNibName</code> function call in the <code>viewDidLoad</code> method, that nib is not loaded, and it continues with the <strong>myViewController.xib</strong> file. What's wrong with my call? Should I specify a bundle?</p>
  
  <p>Thanks!</p>