[英]iOS 6 & 7 status bar design
I am currently working on an iOS 6 app. 我目前正在使用iOS 6应用。 Running this application on iPhone 4/5 runs well.
在iPhone 4/5上运行此应用程序运行良好。 The only problem is that with the new iOS 7 coming out, the design are ruined.
唯一的问题是,随着新的iOS 7的发布,设计被毁了。 Status bar are now part of the app, and all the view in my application get push to the top, overlap with the status bar.
状态栏现在是应用程序的一部分,应用程序中的所有视图都被推到顶部,与状态栏重叠。
What is the best solution to resolve this issue? 解决此问题的最佳解决方案是什么? I am using UINavigationController and some custom view.
我正在使用UINavigationController和一些自定义视图。 Done some reading, some suggest that I include a custom container view to create something like iOS 6 'status bar', since the view at the top will be black and empty.
做完一些阅读后,有人建议我包括一个自定义容器视图,以创建类似iOS 6的“状态栏”,因为顶部的视图将为黑色且为空。 Is there any other solution to this?
还有其他解决方案吗? Or maybe the right way to fix my apps to support both iOS 6 & 7 design?
还是修复我的应用程序以支持iOS 6和7设计的正确方法?
There is a simplest solution for this. 有一个最简单的解决方案。 We have to Thank apple for this concept.
我们必须感谢苹果的这个概念。
Checkout the solution below 查看以下解决方案
Note: You have to have uncheck the "Use Autolayout" in order to use delta 注意:您必须取消选中“使用自动版式”以使用增量
Enjoy Programming!! 享受编程!
One solution that will allow you to: 一种解决方案将使您能够:
. 。 .
。 .
。 is to add the following to your view controller:
将以下内容添加到您的视图控制器:
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7"))
{
self.edgesForExtendedLayout = UIRectEdgeNone;
}
. 。 .
。 since, I'm using code-based views, I add it in loadView, however it would also work in viewDidLoad
因为我使用的是基于代码的视图,所以将其添加到loadView中,但是它也可以在viewDidLoad中使用
Try this in your AppDelegate.m in didFinishLaunching 在didFinishLaunching的AppDelegate.m中尝试此操作
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
[application setStatusBarStyle:UIStatusBarStyleLightContent];
self.window.clipsToBounds =YES;
self.window.frame = CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.