我的 iPad 应用程序上的应用程序状态栏出现了这个问题。
我正在使用 UINavigationController。 Root View Controller 通过在 shoulAutoRotate 方法中返回 YES 来允许所有旋转。这个 Root View Controller 在纵向或横向方向上有两种不同的外观,我已经设法在不使用 nib 文件的情况下以编程方式对其进行修改。
问题是,当我以横向方式启动我的应用程序时,有时状态栏会以纵向方式显示。这将导致 View 顶部出现白条,或者在 iPad 处于横向模式时强制 VC 加载纵向 View 。
我验证了我的 plist 文件,它针对所需的方向进行了正确设置
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
发生的另一件事是,当我在横向模式下推送一个不显示状态栏的 View Controller 时,它会正确消失。但是当导航 Controller 弹出该 vc 时,状态栏将返回纵向甚至纵向颠倒。
这是一个错误还是我做错了什么? 我可以写很多代码,但我不想让问题变得不可读。随时询问您需要的代码的任何部分。
提前致谢!
最佳答案
尝试:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES; }
关于ipad - 状态栏方向问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5202609/