在iOS 6.0中设置状态栏方向 [英] Set status bar orientation in iOS 6.0

查看:232
本文介绍了在iOS 6.0中设置状态栏方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

setStatusBarOrientation:animated:在iOS 6中无效

在iOS 6.0中,由于默认情况下AppDelegate扩展了UIRepsonder而不是UIApplication,因此没有全局的sharedApplication对象。我错过了什么吗?我正在尝试使用以下设置状态栏方向,它似乎不再起作用。我在iOS 6.0模拟器上测试过它。我知道您可以从plist设置中设置状态栏色调颜色,但有人可以告诉我如何在iOS 6.0中以编程方式设置状态栏方向吗?

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]


推荐答案

修正了此问题。它只有在我的rootViewController中实现以下方法时才有效。

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

-(BOOL)shouldAutorotate
{
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return 0;
}

这篇关于在iOS 6.0中设置状态栏方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆