【发布时间】:2018-11-19 09:41:44
【问题描述】:
使用 UIApplication.shared 的键值显示/隐藏状态栏。
我尝试过覆盖方法prefersStatusBarHidden,但没有得到结果。
【问题讨论】:
-
@EneaDume 已弃用
-
看看这个,这家伙和你有同样的问题:stackoverflow.com/questions/35028262/…
使用 UIApplication.shared 的键值显示/隐藏状态栏。
我尝试过覆盖方法prefersStatusBarHidden,但没有得到结果。
【问题讨论】:
没有状态栏的视图控制器
class ViewControllerWithoutStatusBar: UIViewController {
//your logic here
override var prefersStatusBarHidden: Bool {
return false
}
}
带状态栏的视图控制器
class ViewControllerWithStatusBar: UIViewController {
//your here here
override var prefersStatusBarHidden: Bool {
return true
}
}
【讨论】: