Search code examples
ipadios6uiinterfaceorientationuiapplicationuistatusbar

Set status bar orientation in iOS 6.0


Possible Duplicate:
setStatusBarOrientation:animated: not working in iOS 6

In iOS 6.0, as AppDelegate by default extends UIRepsonder and not UIApplication there is no global sharedApplication object. Am I missing anything? I am trying to set status bar orientation using following and it doesn't seem to work anymore. I tested it on iOS 6.0 simulator. I know you can set status bar tint color from the plist settings but can anyone please tell me how to set status bar orientation programmatically in iOS 6.0?

 [[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationPortrait animated:NO]

Solution

  • Fixed this. It works only if I have following methods implemented in my rootViewController.

    -(BOOL)shouldAutorotate
    {
        return YES;
    }
    
    -(NSUInteger)supportedInterfaceOrientations
    {
        return 0;
    }