且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

设置状态栏?

更新时间:2023-01-14 09:51:26

为此,您可以根据事件执行以下操作:

Well for this you can do following based on events:

//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: .

or you can tweak prefersStatusBarHidden: as well.