Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift Can';t在avplayervewcontroller'中隐藏状态栏;人像模式_Swift_Cocoa Touch_Ios9_Avplayer_Avplayerviewcontroller - Fatal编程技术网

Swift Can';t在avplayervewcontroller'中隐藏状态栏;人像模式

Swift Can';t在avplayervewcontroller'中隐藏状态栏;人像模式,swift,cocoa-touch,ios9,avplayer,avplayerviewcontroller,Swift,Cocoa Touch,Ios9,Avplayer,Avplayerviewcontroller,我正在开发一个应用程序,它首先显示一个UICollectionView,其中有一组按钮,可以通过自定义的“全屏”序列打开AvPlayServiceWController的子类。 UIViewControllerBasedStatusBarAppearance在my Info.plist中设置为YES 以下是Interface Builder中所有视图控制器的小屏幕截图(抱歉,必须缩小): segue是在IB中定义的。当用户点击集合视图单元格时,我使用performsguewithidentif

我正在开发一个应用程序,它首先显示一个UICollectionView,其中有一组按钮,可以通过自定义的“全屏”序列打开AvPlayServiceWController的子类。 UIViewControllerBasedStatusBarAppearance在my Info.plist中设置为YES

以下是Interface Builder中所有视图控制器的小屏幕截图(抱歉,必须缩小):

segue是在IB中定义的。当用户点击集合视图单元格时,我使用performsguewithidentifier()来执行segue

我现在遇到的问题是:

为什么在横向模式下,状态栏与播放控件一起隐藏,而在纵向模式下则完全相反


在我的AVPlayerViewController子类中使prefersStatusBarHidden()返回true没有任何作用。给出了什么?

刚刚想出了一个解决方案:

extension UINavigationController {
    public override func childViewControllerForStatusBarHidden() -> UIViewController? {
        return self.childViewControllers.last
    }

    public override func childViewControllerForStatusBarStyle() -> UIViewController? {
        return self.childViewControllers.last
    }
}
是的,只需覆盖应用程序中所有导航视图控制器的这两个功能即可。我认为这是一个黑客,而不是这个问题的“正确”的解决方案,所以谨慎使用。< /P> 据我所知,这是永远不会失败的。在我的应用程序中,每个导航VC只有一个子VC,但YMMV。

我看到“方法不会覆盖其超类中的任何方法”-您在swift 3中有更新的方法吗?