title: How to check in which position (landscape or portrait) is the iPhone now?
body: <p>I have an app with a tab bar, and nav controllers in each tab. When user shakes the device, a <code>UIImageView</code> appears as a child view in the nav controller. But the <code>UIImageView</code> must contain a special image, depending on the device's current orientation. </p>
  
  <p>If I write just </p>
  
  <pre><code>- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)
     if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) { 
     //Code
     }
     else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight||interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
     //Code
     }
  }
  </code></pre>
  
  <p>The view just goes crazy if user rotated the device before shaking. </p>
  
  <p><strong>Is there a method to get iPhones current orientation?</strong></p>