设置状态栏?
set status bar?
如何在点击或值更改等事件中动态隐藏、显示或更改状态栏?
我用谷歌搜索了一口井,但我得到的结果从一开始就变成了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
:。
UIApplication.sharedApplication().setStatusBarHidden=true
您正在寻找var prefersStatusBarHidden: Bool { get }
在您的视图控制器中重写该函数。使用 func setNeedsStatusBarAppearanceUpdate()
动态更新状态栏的可见性
https://developer.apple.com/reference/uikit/uiviewcontroller/1621440-prefersstatusbarhidden
如何在点击或值更改等事件中动态隐藏、显示或更改状态栏?
我用谷歌搜索了一口井,但我得到的结果从一开始就变成了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
:。
UIApplication.sharedApplication().setStatusBarHidden=true
您正在寻找var prefersStatusBarHidden: Bool { get }
在您的视图控制器中重写该函数。使用 func setNeedsStatusBarAppearanceUpdate()
https://developer.apple.com/reference/uikit/uiviewcontroller/1621440-prefersstatusbarhidden