ipad - 状态栏方向问题

标签 ipad ios uinavigationcontroller statusbar uiinterfaceorientation

我的 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/

相关文章:

javascript - 在 "ended"上播放数组中的下一个视频

ios - Xcode 从 @2x 版本创建的非视网膜图像的质量如何?

ios - 维护多个 Storyboard的导航栏?

iphone - UINavigationController 子类 navigationItem 忽略 -setLeftBarButtonItem

swift - 栏按钮未出现在 PageViewController 中

javascript - iPad Safari 弹出问题

iphone - 将 iOS 设备上的触摸发送到另一个 UIScreen(外部显示器)

iOS 8 Swift 导航栏标题,按钮未显示在基于选项卡的应用程序中

iphone - 是否可以在 IOS 上第二次请求推送通知?

ios - iOS如何命名单元格ID?