iOS 13 中的 PrefersStatusBarHidden 问题 [英] prefersStatusBarHidden issue in iOS 13
问题描述
大家好,我正在尝试将我的 statusBar 隐藏在 View Controller
中,但它似乎不起作用.. 我使用了该功能:
覆盖 var prefersStatusBarHidden: Bool {返回真}
<小时>
我还将plist
文件中的基于视图控制器的状态栏外观
设置为YES>
我的状态栏不想隐藏......我哪里做错了?
看起来您正试图在单个 ViewController
中专门隐藏状态栏.
为了做到这一点,您需要在 ViewController
self.modalPresentationCapturesStatusBarAppearance = true
override var prefersStatusBarHidden: Bool {返回假}
我还在我的 .plist
中添加了 View controller-based status bar appearance
并将其设置为 YES
.
在最新的 iOS 13 上测试过.
Hi everyone I'm trying to hide my statusBar in a View Controller
but it doesn't seem to work .. I used the function:
override var prefersStatusBarHidden: Bool {
return true
}
I also set the View controller-based status bar appearance
in the plist
file to YES
My status bar doesn't want to hide ... where am I doing wrong?
It looks like you're trying to specifically hide the status bar in a single ViewController
.
In order to do that, you need have the following in that ViewController
self.modalPresentationCapturesStatusBarAppearance = true
override var prefersStatusBarHidden: Bool {
return false
}
I also added View controller-based status bar appearance
in my .plist
and set it to YES
.
Tested on the latest iOS 13.
这篇关于iOS 13 中的 PrefersStatusBarHidden 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!