Set status bar orientation in iOS 6.0 [duplicate]

2019-05-01 01:15发布

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]

1条回答
女痞
2楼-- · 2019-05-01 01:52

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

-(BOOL)shouldAutorotate
{
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return 0;
}
查看更多
登录 后发表回答