繁体   English   中英

导航栏隐藏状态栏

[英]Navigation Bar hiding status bar

如标题所示,我有一个导航栏,它隐藏了我的状态栏。 我一直在模拟器上运行我的应用程序,最近开始在iPhone 4s iOS7设备上运行它,并注意到状态栏处于隐藏或隐藏状态,您唯一能看到的就是绿色电池寿命。 我认为它被隐藏的原因是,我的一个视图控制器中有一个搜索栏,当我使用搜索栏时,您可以看到状态栏,单元格提供者,时间等。

我已经做过的事情以查看是否不是偶然发生的:

Checked the Target-> Deployment Info ->Status Bar Style. It is in Default.

Checked each xib file to see if the status bar is set to none. All of them are at Default.

Searched the keyword "hidden" in all my .m files.

有人有什么建议吗? 我在这里搜索过,仅看到有关实际上想要隐藏它而不修复它的人的帖子。 如果有人发生过类似的事情,我愿意尝试任何事情。

回答:

I was using a navigation bar image and the sizes were different. 
I was using iOS6 bar size, 32x32, but now I am using 88x64 and 
that fixed it for iOS7. How do I check if phone is iOS6 or iOS7?

状态栏未隐藏。 在iOS 7上,状态栏始终可见,并且以与iOS 6及更低版本上不同的方式与您的应用程序重叠。 这是新的“正常”行为。 状态栏不再具有背景色。 它是透明背景上的黑色文本( UIStatusBarStyleDefault )或透明背景上的浅色文本( UIStatusBarStyleLightContent )。

如果将状态栏外观更改为“浅色内容”,您将能够在深色背景上看到状态栏。

状态栏外观是通过两个互斥的基本路径之一控制的:您可以以传统方式通过编程方式设置它们,或者UIKit将基于UIViewController的一些新属性为您更新外观。 默认情况下,后一个选项处于启用状态。 检查应用程序的“基于ViewController的状态栏外观”的plist值,以查看使用的是哪个。 如果将此值设置为YES ,则应用中的每个顶级视图控制器(标准UIKit容器视图控制器除外)都需要重写preferredStatusBarStyle ,以返回默认样式或浅色样式。 如果将plist值编辑为NO ,则可以使用熟悉的UIApplication方法管理状态栏的外观。

我知道它的knida为时已晚,但是这种方法通过状态栏解决了我的问题:

我所做的是

   self.view.backgroundcolor=[UIcolor WhiteColor];

然后在主视图内创建一个宽度和高度与self.view相同的子视图,然后相应地修改其框架,例如:

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
    if(self.customView.frame.origin.y == 0) {
        CGRect viewBounds = [self.customView bounds];
        viewBounds.origin.y = 20;
        viewBounds.size.height = viewBounds.size.height - 20;
        self.customView.frame = viewBounds;
    }

}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM