3

我的 iPad 应用程序的应用程序状态栏出现此问题。

我正在使用 UINavigationController。根视图控制器通过在 shouAutoRotate 方法中返回 YES 来允许所有旋转。当涉及到纵向或横向时,这个根视图控制器有两种不同的外观,我已经设法在不使用 nib 文件的情况下以编程方式对其进行修改。

问题是当我以横向启动我的应用程序时,有时状态栏会是纵向的。这将导致视图顶部出现白条,或者在 iPad 处于横向模式时强制 VC 加载纵向视图。

我验证了我的 plist 文件,它已正确设置为所需的方向

<key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>

发生的另一件事是,当我在横向模式下推动视图控制器时,它不显示状态栏,它会正确消失。但是当导航控制器弹出该vc时,状态栏将返回纵向甚至纵向倒置。

这是一个错误还是我做错了什么?我可以放很多代码,但我不想让这个问题不可读。随意询问您需要的代码的任何部分。

提前致谢!

4

1 回答 1

2

尝试:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES; }
于 2011-09-16T02:25:34.300 回答