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

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

问题描述

我可以在我的应用中隐藏状态栏:

I can hide a status bar in my app:

- (void)viewDidLoad{
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
    [super viewDidLoad];
    }

当我选择我的启动图像并第一次启动时,它的状态栏结束照片。我怎么能隐藏这个?

When I chose my launch image and start it first time, it's status bar over a picture. How can I hide this?

推荐答案

将以下代码添加到视图控制器:

Add the following code to your view controller:

if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
    // iOS 7
    [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
} else {
    // iOS 6
    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
}

- (BOOL)prefersStatusBarHidden {
    return YES;
}

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

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