导航栏上的iOS7状态栏

问题描述:

我正在使用iOS7测试我的应用程序,我的状态栏有问题。基本上状态栏显示在导航栏上,如下图所示:

I'm testing my application with iOS7 and I have an issue with status bar. Basically the status bar appear over navigation bar like the image below:

我尝试拨打 viewDidLoad

 self.edgesForExtendedLayout = UIRectEdgeNone;
 self.automaticallyAdjustsScrollViewInsets = YES;

没有成功。

我也有添加到 info.plist 文件 UIViewControllerBasedStatusBarAppearance 没有运气。

I have also added to the info.plist file UIViewControllerBasedStatusBarAppearance with no luck.

主要问题是应用程序必须与iOS6和iOS7兼容,目前在iOS7上,视图从顶部移动了20px。

The main problem is that the application must be compatible with iOS6 and iOS7 and currently on iOS7 the view shifted 20px from the top.

edgesForExtendedLayout automatedAdjustsScrollViewInsets 只是父视图控制器如何布局/管理视图的标准。看起来你正在使用UINavigationBar,而不是UINavigationController,这意味着除非你将它们编码,否则这些属性不会做任何事情。

edgesForExtendedLayout and automaticallyAdjustsScrollViewInsets are just standards for how parent view controllers lay out / manage the view. It looks like you're using a UINavigationBar, but not a UINavigationController, which means these properties won't do anything unless you code them to.

你可以切换到使用UINavigationController,或者您可以在iOS 7上以编程方式将UINavigationBar的高度从44更改为64.

You can switch to use a UINavigationController, or you can programmatically change the height of your UINavigationBar from 44 to 64 on iOS 7.