title: How to get the devices UIInterfaceOrientation
body: <p>I am trying to capture when the UIInterfaceOrientation changes. I know how to do it with UIDeviceOrientation but I am wanting to prevent anything but landscape left/right and portrait.</p>
  
  <p>I was using UIDeviceOrientation but every time I laid it face up everything would go crazy on my app.</p>
  
  <p>So I was wanting to know how to do something like this</p>
  
  <pre><code>UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
  
          UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
  
  
          CGFloat screenHeight = [[UIScreen mainScreen] bounds].size.height;
  
          CGFloat screenWidth = [[UIScreen mainScreen] bounds].size.width;
  
  if (interfaceOrientation landscape) {
              if (orientation == UIDeviceOrientationLandscapeLeft)
              {
  
               }
               else if (orientation == UIDeviceOrientationLandscapeRight)
              {
  
               }
        }
  
  if (interfaceOrientation Portrait) {
  
  
  }
  </code></pre>
  
  <p>so I only look at either landscape or portrait.</p>
  
  <p>any help would be greatly appreciated.</p>