【发布时间】:2020-05-01 03:33:13
【问题描述】:
大家好,我正试图将我的 statusBar 隐藏在 View Controller 中,但它似乎不起作用.. 我使用了该功能:
override var prefersStatusBarHidden: Bool {
return true
}
我还将plist文件中的View controller-based status bar appearance设置为YES
我的状态栏不想隐藏...我哪里做错了?
【问题讨论】:
-
View controller-based status bar appearance到NO下Info.plist。您可以检查状态栏的设置here -
试试这个:
(UIApplication.shared.value(forKey: "statusBarWindow") as? UIWindow)?.isHidden = false -
崩溃并出现此错误 UIApplication: 此代码必须更改,因为不再有状态栏或状态栏窗口。在窗口场景中使用 statusBarManager 对象。'
-
@kAiN 你检查我的答案了吗?我现在已经用
Status bar is initially hidden作为YES和View controller-based status bar appearance作为NO在plist中的空项目进行了测试,没有添加任何代码 - 状态栏在 iOS13.3 和 iPhone11 上是隐藏的 -
@VadimNikolaev 是的,我知道,但我需要我的状态栏不仅在特定的视图控制器中可见
标签: ios swift uiviewcontroller statusbar