xcode 在启动图像上隐藏状态栏

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11864993/
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-15 01:10:53  来源:igfitidea点击:

Hide status bar on launch image

iphoneobjective-ciosxcodestatusbar

提问by Sergey Grischyov

Is there a way to hide the status bar when the app's launch image is displayed and then bring it back?My app has a black status bar and the one displayed over the launch image is grey.

有没有办法在显示应用程序的启动图像时隐藏状态栏,然后将其恢复?我的应用程序有一个黑色状态栏,显示在启动图像上的状态栏是灰色的。

Is there any solution for this?

有什么解决办法吗?

回答by Hemant Dixit

Use this code for hiding status bar:

使用此代码隐藏状态栏:

ObjectiveC:

目标C:

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

Swift:

迅速:

UIApplication.sharedApplication().setStatusBarHidden(true, withAnimation: .Slide)


If you don't need status bar in the beginning. Add this setting (UIStatusBarHidden)in your Info plistfile:

如果一开始不需要状态栏。在您的信息文件中添加此设置( UIStatusBarHidden)plist

Status bar is initially hidden

with a value of YES.

值为YES

Use this code anywhere in the app to show the status bar for that particular View Controller

在应用程序的任何地方使用此代码来显示该特定视图控制器的状态栏

ObjectiveC:

目标C:

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

Swift:

迅速:

UIApplication.sharedApplication().setStatusBarHidden(false, withAnimation: .Slide)

回答by The iOSDev

Just define a key in plist file will solve your problem

只需在 plist 文件中定义一个键即可解决您的问题

enter image description here

在此处输入图片说明

Happy Coding:)

快乐编码:)

回答by Hossam Ghareeb

You can initially add this key in the info.plist file: status bar is initially hidden=YES

您最初可以在 info.plist 文件中添加此键: status bar is initially hidden=YES

Then in the app delegate, add this line in the application:didFinishLaunchingWithOptions:method:

然后在应用程序委托中,在application:didFinishLaunchingWithOptions:方法中添加这一行:

  [[UIApplication sharedApplication] setStatusBarHidden:NO];

回答by Arash Zeinoddini

To return it back:

要将其退回:

- (void)applicationDidFinishLaunching:(UIApplication *)application {
    // Override point for customization after app launch

    [[UIApplication sharedApplication] setStatusBarHidden:NO];
}

回答by Apurv

Add below key to info.plist:

将以下键添加到 info.plist:

"Status bar is initially hidden" and select YES as value.

“状态栏最初是隐藏的”并选择 YES 作为值。