简体   繁体   English

iOS 6导航栏位于状态栏下方

[英]iOS 6 navigation bar is under status bar

So im writing an app that needs to support ios 6 and 7, app looks good in iOS 7 but on iOS 6 for some reason the navigation bar sits underneath the status bar and i have no idea why. 所以即时编写一个需要支持ios 6和7的应用程序,app在iOS 7中看起来不错,但在iOS 6上出于某种原因,导航栏位于状态栏下方,我不明白为什么。 it happens on all of my screens 它出现在我的所有屏幕上

在此输入图像描述

i've tried settings the status bar to opaque but everything i have tried still leaves it as translucent, i thought maybe having it opaque would make it move down (i would prefer to keep it translucent though) 我已经尝试将状态栏设置为不透明,但我尝试过的所有东西仍然是半透明的,我想可能让它不透明会让它向下移动(我宁愿保持它半透明)

running Xcode 5.1.1 运行Xcode 5.1.1

i have my own navigation controller implemented, but all it does is set self.navigationBar.tintColor = THEME_COLOUR; 我实现了自己的导航控制器,但它只是设置为self.navigationBar.tintColor = THEME_COLOUR; (and some other things when in iOS 7 but that doesnt execute here) (以及在iOS 7中但在此处不执行的其他一些事情)

in the storyboard i have unticked 'under top bars' and ive messed around with the UINavigation bar appearance property and nothing seems to affect it 在故事板中,我已经取消了'在顶部栏下',并且我已经弄乱了UINavigation栏外观属性,似乎没有任何影响它

So im not sure why, but i fixed the problem by manually moving the navigation bar down in my root view controller like so: 所以我不知道为什么,但我通过在我的根视图控制器中手动移动导航栏来解决问题,如下所示:

if( ! IS_OS_7_OR_LATER){

    CGRect navFrame = self.navigationController.navigationBar.frame;
    navFrame.origin.y += 20;
    self.navigationController.navigationBar.frame = navFrame;
}

it seems to be something to do with my login view having a hidden nav bar, then my root view unhiding the nav bar, but im not sure exactly what. 它似乎与我的登录视图有一个隐藏的导航栏,然后我的根视图取消隐藏导航栏,但我不确定究竟是什么。 but luckily i only needed that code in the root view and it seemed to affect all subsequent views (probably because the status bar and nav bar are inferred in the storyboard) 但幸运的是我只需要在根视图中使用该代码,它似乎会影响所有后续视图(可能是因为状态栏和导航栏是在故事板中推断出来的)

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

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