如何在iOS中为整个应用设置隐藏的状态栏? [英] How to set status bar hidden for entire app in iOS?

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

问题描述

我正在尝试隐藏整个iOS应用的状态栏。 (应用程序部署目标设置为iOS 7.1)。

I am trying to set the status bar of my entire iOS app hidden. (The app deployment target is set to iOS 7.1).

我尝试了以下(并且没有工作):

I have tried the following (and none worked):

将此行添加到应用程序:AppDelegate.m中的didFinishLaunchingWithOptions:

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

以及此行:

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

我已经尝试将故事板视图中每个视图控制器的statusBar设置为None - > Attributes检查员 - >模拟指标。

I have tried setting the statusBar to None for each of my View Controllers in Storyboard View --> Attributes inspector --> Simulated Metrics.

我试过添加密钥状态栏最初隐藏在Info中为YES我的应用程序的.plist文件。

I have tried adding the key Status bar is initially hidden as YES in Info.plist file of my app.

这些都不起作用。任何人都可以指导我哪里出错了?
顺便说一句,我在我的Mac上使用最新版本的XCode,在我的测试设备上使用最新版本的iOS。并且,我的所有视图控制器仅在属性检查器中设置为横向模式。应用程序支持的方向是横向两侧。

None of these worked. Can anyone guide me as to what is wrong? Btw, I am using the latest version of XCode on my Mac and latest iOS on my test device. And, all my View Controllers have been set to Landscape mode only in Attributes inspector. And the supported orientations of the app are Landscape both sides.

推荐答案

只需在.plist文件中设置这两个属性。然后你将好好去。

Just set both properties in your .plist file.Then you will be good to go.

1.查看基于控制器的状态栏外观 -

1.View controller-based status bar appearance -No

2.Status bar最初是隐藏的 - 是

2.Status bar is initially hidden-YES

希望这会有所帮助!

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

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