检查状态栏是否隐藏或可见

发布于 2024-11-30 05:34:01 字数 67 浏览 6 评论 0原文

我想检查状态栏的状况。我如何检查状态栏是否可见。

请任何人指导我做到这一点..

谢谢大家

I want to check condition for statusbar. How can i check condition if status bar is visible or not .

please anyone guide me to do this..

Thank you all

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

王权女流氓 2024-12-07 05:34:01

检查状态栏是否隐藏:

Objective C:

if ([UIApplication sharedApplication].isStatusBarHidden) {
    // do stuff here...
}

Swift:

if UIApplication.shared.isStatusBarHidden {
    // do stuff here...
}

隐藏状态栏:

override var prefersStatusBarHidden: Bool {
    return true
}

Check if status bar is hidden:

Objective C:

if ([UIApplication sharedApplication].isStatusBarHidden) {
    // do stuff here...
}

Swift:

if UIApplication.shared.isStatusBarHidden {
    // do stuff here...
}

Hide status bar:

override var prefersStatusBarHidden: Bool {
    return true
}
满意归宿 2024-12-07 05:34:01

Swift 3

if UIApplication.shared.isStatusBarHidden {
    // Do something
}

隐藏状态栏(setStatusBarHidden 在 iOS 9 中已弃用)
在您的 ViewController 中覆盖:

override var prefersStatusBarHidden: Bool {
    return true
}

Swift 3

if UIApplication.shared.isStatusBarHidden {
    // Do something
}

To hide the status bar (setStatusBarHidden is deprecated in iOS 9)
override in your ViewController:

override var prefersStatusBarHidden: Bool {
    return true
}
樱花坊 2024-12-07 05:34:01

您可以使用 [UIApplication sharedApplication]statusBarHidden 属性检查当前状态

您可以使用 – setStatusBarHidden:withAnimation: 设置当前状态

请参阅更多精彩东西。

华泰

You can check the current state by using the statusBarHidden property of [UIApplication sharedApplication]

You can set the current state using – setStatusBarHidden:withAnimation:

See the docs for more awesome stuff.

HTH

溺ぐ爱和你が 2024-12-07 05:34:01

您还可以在界面生成器的 xib 中的视图属性中检查这一点,您可以看到灰色/黑色/半透明/未指定的四个选项。

U can Also check this in xib of interface builder in view attributes u can see four options for it gray/ black/ translucent/ unspecified..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文