Wednesday, 29 May 2013

To check device orientation in viewDidLoad



Add below lines of code in -(void)viewDidLoad method

 UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];

if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
        // portrait
        
    } else {
        // landscape
        
    }