I've only one app delegate and view controller in my app. The app works in both portrait and landscape modes. In my view controller's viewWillAppear method I'm getting the orientation of the device usisng following code:
UIInterfaceOrientationIsPortrait([[UIDevice currentDevice] orientation])
First time when I am running the application, even when my device is in portrait, its giving the result as landscape. Why is it so. How can I solve this?
I have had a ton of problems with currentDevice.orientation Try this:
UIDeviceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])