设置状态栏? [英] set status bar?

查看:34
本文介绍了设置状态栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在点击或值变化等事件时动态隐藏、显示或更改状态栏?

How to hide, show or change the status bar dynamically on events such as click or value change?

我用谷歌搜索了一口井,但我得到的一切从一开始就改变了 这个.这里我需要动态地做.

I've googled for a well, but all I get is changed from the beginning as this. Here I need to do it dynamically.

推荐答案

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

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.

这篇关于设置状态栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆