问题
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