如何在iOS 7中隐藏状态栏? [英] How to hide status bar in iOS 7?

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

问题描述

我已尝试在我的应用 .plist 文件中设置以下内容:

I have tried setting the following in my app .plist file:

查看基于控制器的状态栏外观:否

虽然这会从我的初始视图控制器中删除它,但一旦我转到另一个视图并且来回到我的导航控制器,它回来了,这次它不会消失。此外,我不明白为什么它会重要,但我也将模拟指标下的状态栏设置为无,但这似乎没有帮助。我知道我将有导航栏但我需要的状态栏。

And while this removes it from my initial view controller, once I go to another view and come back with my navigation controller, it comes right back and this time it does not disappear. Also, I don't see why it would matter but I have also set the status bar under simulated metrics to "None" but that doesn't seem to help. I know i am going to have the navigation bar but the status bar I need gone.

我怎样才能完成这项工作? 请提供详细的答案,示例代码会很棒!

How can I get this done? Please provide a detailed answer, sample code would be great!

更新:这不是一个重复的解决方案,因为我已经尝试了所有其他解决方案没有人似乎对我有用。最近我试过

Update: This is NOT a duplicate solution as I have tried all other solutions and NONE seem to work for me. Most recently I tried

[[UIApplication sharedApplication]setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];

再次,没有结果。当应用程序最初启动时,状态栏不存在,在用户访问另一个视图后,状态栏现在出现在2和其他视图中,并且不会消失。即使你回到主视图。

Again, with no results. When the app initially launches a status bar is NOT present, after the user visits another view, the status bar is now present in the 2 and other views and does not go away. Even if you go back to the main view.

推荐答案

我已经尝试了所有在这里发布的建议,不幸的是发生了什么这是一个小错误,在我的 viewDidLoad 我有:

I have tried all of the suggestions that were posted here, unfortunately what happened here was a small mistake, in my viewDidLoad I had:

[[UIApplication sharedApplication ] setStatusBarHidden:YES];

但是在我的 viewWillAppear 我有:

[[UIApplication sharedApplication] setStatusBarHidden:NO];

所以这只是一个压倒一切的问题,现在问题得到解决。

So this was just an issue of overriding, problem fixed now.

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

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