title: iPad launch orientation when flat on surface
body: <p>I have the following code:</p>
  
  <pre><code> -(void)viewWillAppear:(BOOL)animated {
  
      UIDeviceOrientation orientation = [[UIDevice currentDevice] UIInterface];
  
      if(orientation==UIDeviceOrientationLandscapeLeft || orientation==UIDeviceOrientationLandscapeRight) {
          NSLog(@"Device Landscape");
      } else {
          NSLog(@"Device Portrait");
      }
  
   }
  </code></pre>
  
  <p>This works perfectly for the simulator and on the device but only if the iPad is not flat on a surface, for example if i lay the iPad on my desk and load the view it will say its portrait and so I cant detect the orientation when the view appears.</p>
  
  <p>Any ideas of the best way to detect the interface orientation when the viewWillAppear is called?</p>
  
  <p>Thanks</p>