如何在点击或值更改等事件中动态隐藏、显示或更改状态栏?
我用谷歌搜索了一口井,但我得到的结果从一开始就变成了this .这里我需要动态地做。
最佳答案
为此,您可以根据事件执行以下操作:
//For hiding/unhiding:
func hideStatusBar(shouldHide:Bool){
UIApplication.shared.isStatusBarHidden = shouldHide
}
//For Light Style:
func lightStatusBar(){
UIApplication.shared.statusBarStyle = .lightContent
}
//For Standard Style:
func standardStatusBar(){
UIApplication.shared.statusBarStyle = .default
}
或者您也可以调整 prefersStatusBarHidden
: 。
关于ios - 设置状态栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43752721/