Set status bar orientation in iOS 6.0 [duplicate]

北城以北 提交于 2019-12-07 06:52:13

问题


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:


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

-(BOOL)shouldAutorotate
{
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return 0;
}


来源:https://stackoverflow.com/questions/12691120/set-status-bar-orientation-in-ios-6-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!