如何在iOS 8中以编程方式隐藏状态栏 [英] How to hide the status bar programmatically in iOS 8

查看:130
本文介绍了如何在iOS 8中以编程方式隐藏状态栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就像问题所说,我需要在用户点击时隐藏状态+导航栏。到目前为止,导航栏很容易。找不到办法对状态栏做同样的事情。

Just like the question says, I need to hide status + navigation bar when user taps. So far, navigation bar was easy. Cann't find a way to do the same with status bar.

顺便说一下,试过了

UIApplication.sharedApplication().statusBarHidden = true

但还没有运气

推荐答案

您应该将此键/值对添加到项目的Info.plist中。

You should add this key/value pair to your project's Info.plist.

<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>

之后,调用

UIApplication.sharedApplication().statusBarHidden = true

UIApplication.sharedApplication().setStatusBarHidden(true, withAnimation: .Fade) // with animation option.

这篇文章提供了更多详细信息> 如何隐藏iOS状态栏

This post gives more details > How to hide iOS status bar

这篇关于如何在iOS 8中以编程方式隐藏状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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