objective-c 如何在iphone中出现闪屏时隐藏状态栏?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1147706/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 21:56:06  来源:igfitidea点击:

how to hide status bar when splash screen appears in iphone?

iphoneobjective-cxcodestatusbar

提问by Rahul Vyas

Is there a way to hide the status bar when showing splash screen in iPhone and then show again in application?

有没有办法在 iPhone 中显示启动画面时隐藏状态栏,然后在应用程序中再次显示?

回答by Dave DeLong

I'm pretty sure that if your Info.plist file has the Status bar is initially hiddenvalue set to YES, then it won't show while your application is loading. Once your application has loaded, you can re-show the status bar using UIApplication's setStatusBarHidden:animated:method.

我很确定,如果您的 Info.plist 文件的Status bar is initially hidden值设置为YES,那么在您的应用程序加载时它不会显示。一旦您的应用程序加载完毕,您就可以使用 UIApplication 的setStatusBarHidden:animated:方法重新显示状态栏。

回答by Max

The correct key in .plist is "UIStatusBarHidden" and make checked right side.It'l become "Status bar is initially hidden" then automatically. In my practice, you can control the StatusBar's show/hide anywhere by when hide:

.plist 中的正确键是“UIStatusBarHidden”,并在右侧进行检查。它会自动变为“状态栏最初是隐藏的”。在我的实践中,您可以通过何时隐藏来控制状态栏的显示/隐藏:

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
[UIApplication sharedApplication].keyWindow.frame=CGRectMake(0, 0, 320, 480); //full screen.

when show:

显示时:

[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO];
[UIApplication sharedApplication].keyWindow.frame=CGRectMake(0, 20, 320, 460); //move down 20px.

hope this was helpful to you.

希望这对你有帮助。

回答by Jonathan Sterling

View -> Property List Type -> iPhone Info.plist. Now, make a new item with "Status bar is initially hidden" checked.

查看 -> 属性列表类型 -> iPhone Info.plist。现在,在选中“状态栏最初是隐藏的”的情况下创建一个新项目。

回答by Josh Peak

Following up Dave's answer the key "Status bar is initially hidden" didn't work for me under iOS 4.3 BUT the key "UIStatusBarHidden" and then setting it's type to Boolean and checking the box did the trick.

跟进戴夫的回答,关键“状态栏最初是隐藏的”在 iOS 4.3 下对我不起作用,但关键“UIStatusBarHidden”然后将它的类型设置为布尔值并选中该框就可以了。

http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html#//apple_ref/doc/uid/TP40009254-SW4

http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html#//apple_ref/doc/uid/TP40009254-SW4

This developer article got me onto the Info.plist keys and then working out the equivalent key for hiding it wasn't too hard.

这篇开发人员文章让我了解了 Info.plist 键,然后找出隐藏它的等效键并不太难。

Interestingly the "UIStatusBarStyle" needs to use the enumeration name as a string for it to work.

有趣的是,“UIStatusBarStyle”需要使用枚举名称作为字符串才能工作。

回答by Ian Jamieson

For Xcode 5 and above you can just set:

对于 Xcode 5 及更高版本,您只需设置:

View controller-based status bar appearance to NO

查看基于控制器的状态栏外观为 NO

In your info.plist, or in the info tab on your main project.

在您的 info.plist 或主项目的信息选项卡中。

Example of Info settings in xcode

xcode 中的信息设置示例

回答by Usman

write this 1 line in to your main .m viewDidload method

将此 1 行写入您的主要 .m viewDidload 方法

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

or select info.plist file from your project supporting files folder in workspace

或从工作区中的项目支持文件文件夹中选择 info.plist 文件

set statusbarinitialyhidden to YES

将 statusbarinitialyhidden 设置为 YES

回答by Jonathan Lamim Antunes

is deprecated

已弃用

setStatusBarHidden:(BOOL) animated:(BOOL) 

is the correct

是正确的

setStatusBarHidden:(BOOL) withAnimation:(UIStatusBarAnimation)

UIStatusBarAnimationwhich can be:

UIStatusBarAnimation可以是:

UIStatusBarAnimationNoneor UIStatusBarAnimationFadeor UIStatusBarAnimationSlide

UIStatusBarAnimationNoneUIStatusBarAnimationFadeUIStatusBarAnimationSlide

回答by user2588945

This worked for me in the info.plist:

这在 info.plist 中对我有用:

"View controller-based status bar appearance"  -> set to NO

回答by Vinoth Vino

Add Status bar is initially hiddento YESin the info.plistfile. This worked for me.

加入Status bar is initially hiddenYES了在info.plist文件中。这对我有用。

status bar hidden

状态栏隐藏

回答by Paul Brewczynski

For XML editors ~ add to first child of

对于 XML 编辑器 ~ 添加到

<key>UIStatusBarHidden</key>
<true/>