本文介绍了prefersStatusBarHidden未调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 UITabViewController
- > UINavigationController
- > UIViewController
并希望隐藏和取消隐藏statusBar。当我调用 setNeedsStatusBarAppearanceUpdate()
时,不调用方法 prefersStatusBarHidden
。
I have a UITabViewController
-> UINavigationController
-> UIViewController
and want to hide and unhide the statusBar. when I call setNeedsStatusBarAppearanceUpdate()
the method prefersStatusBarHidden
is not called.
func fadeOutStatusBar (notification: NSNotification) {
statusBarHidden = true
self.setNeedsStatusBarAppearanceUpdate()
}
func fadeInStatusBar (notification: NSNotification) {
statusBarHidden = false
self.setNeedsStatusBarAppearanceUpdate()
}
override func prefersStatusBarHidden() -> Bool {
return statusBarHidden
}
推荐答案
想出来。在info.plist文件中:
视图控制器状态栏外观应设置为YES
Figured it out. in info.plist file: view controller-status bar appearance should be set to YES
这篇关于prefersStatusBarHidden未调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!