I have an app that depending on the orientation shows different images... I have been using:
UIDeviceOrientationIsLandscape([[UIDevice currentDevice] orientation]);
To see if it is landsCape or not... but if I call this in my rootViewController: viewDidLoad
,viewWillAppear
, orviewDidAppear
its always false.... then i was trying figure if its landsCape or no by comparing the width and height of a frame that has autosizeMask so it always is full screen... its a scroll view and I do the following:
BOOL landscape = self.frame.size.width>self.frame.size.height;
But that doesn't work either (always false) because the view still has the frame for the portrait view at that moment.
Instead of using device orientation, check for interface orientation. These macros will help you.
#define IS_PORTRAIT UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])
#define IS_LANDSCAPE UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])