UIDevice Orientation not returning the correct value
<p>Hey this is the code I am using</p>

<pre><code>switch ([[UIDevice currentDevice] orientation]) 

        {
            case UIInterfaceOrientationPortrait:
                [self displayActionSheetInPotraitMode];
                break;
            case UIInterfaceOrientationLandscapeLeft:
            case UIInterfaceOrientationLandscapeRight:
                [self displayActionSheetInLandscapeMode];
                break;

            default:
                break;
        }
</code></pre>

<p>but when I try it in iOS version 4 or 4.1 on the device     </p>

<p>switch ([[UIDevice currentDevice] orientation]) </p>

<p>doesn't return the proper value. My application is to run in IOS 4 onwards. How do I rectify this?</p>
