IOS7 状态栏和 Navigation Bar重叠的问题解决
一 Status bar重叠问题:
方法一:隐藏Status bar 在plist里面增加2个变量 Status bar is initially hidden -> YES View controller-based status bar appearance -> NO
方法二:改为和IOS6 一样的显示方式
Set
UIViewControllerBasedStatusBarAppearance
toNO
ininfo.plist
(To opt out of having view controllers adjust the status bar style so that we can set the status bar style by using the UIApplicationstatusBarStyle method.)In AppDelegate's
application:didFinishLaunchingWithOptions
, callif ([[[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); //Added on 19th Sep 2013
self.window.bounds = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height);
}
方法三:
Set UIViewControllerBasedStatusBarAppearance to NO in info.plist
Pase this code in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
method
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);
//Added on 19th Sep 2013
NSLog(@"%f",self.window.frame.size.height);
self.window.bounds = CGRectMake(0,0, self.window.frame.size.width, self.window.frame.size.height);
}
It may push down all your views by 20 pixels.To over come that use following code in -(void)viewDidAppear:(BOOL)animated
method
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
CGRect frame=self.view.frame;
if (frame.size.height==[[NSUserDefaults standardUserDefaults] floatForKey:@"windowHeight"])
{
frame.size.height-=20;
}
self.view.frame=frame;
}
You have to set windowHeight Userdefaults value after window allocation in didFinishLauncing Method like
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[[NSUserDefaults standardUserDefaults] setFloat:self.window.frame.size.height forKey:@"windowHeight"];
二 Navigation Bar重叠的问题: 在页面刚生成的时候 initWithNibName 函数 或者其他函数中加一句话: if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
self.edgesForExtendedLayout = UIRectEdgeNone;
}
显示方式就和IOS6 一致了。 如果有什么问题,请留言。
IOS7 状态栏和 Navigation Bar重叠的问题解决的更多相关文章
- [Android] 获取系统顶部状态栏(Status Bar)与底部导航栏(Navigation Bar)的高度
Android一些设备都有上下两条bar,我们可以获取这些bar的信息.下面放上获取高度的代码.代码注释和其他方法有空再放. 原文地址请保留http://www.cnblogs.com/rossone ...
- iOS6 / iOS7 状态栏高度适配
问题原因:iOS7的状态栏(status bar)不再占用单独的20px,所以假设你在iOS6上的界面布局是正常的,那么到了iOS7上就会变成以下这个样子: 左边是iOS6界面 ...
- 与Status Bar和Navigation Bar相关的一些东西
Android Navigation Bar Status Bar 与StatusBar和NavigationBar相关的东西有两种,一是控制它们的显示与隐藏,二是控制它们的透明与否及背景. 在2 ...
- Android 4.4 上实现透明导航栏和状态栏 Translucent system bar
Translucent system UI styling To get the most impact out of your content, you can now use new window ...
- Status bar and navigation bar appear over my view's bounds in iOS 7
转自:http://stackoverflow.com/questions/17074365/status-bar-and-navigation-bar-appear-over-my-views-bo ...
- android隐藏底部虚拟键Navigation Bar实现全屏
隐藏底部虚拟键Navigation Bar实现全屏有两种情况 第一种:始终隐藏,触摸屏幕时也不出现 解决办法:同时设置以下两个参数 View.SYSTEM_UI_FLAG_HIDE_NAVIGATIO ...
- 非常不错的Navigation Bar效果
非常不错的Navigation Bar效果,该源码转载于源码天堂的,大家可以了解一下吧,多视图应用程序中,我们常常使用到自定义UINavigationBar来完成导航条的设置. 源码我就不上传了,大家 ...
- HTML5设计网页熔岩灯导航(navigation bar)插件 已经加上完整源代码
导航栏(navigation bar): 1.指位于页眉区域的,在页眉横幅图片上边或下边的一排水平导航按钮,它起着链接博客的各个页面的作用. 2.网页设计中不可缺少的部分,它是指通过一定的技术手段,为 ...
- Customizing Navigation Bar and Status Bar
Like many of you, I have been very busy upgrading my apps to make them fit for iOS 7. The latest ver ...
随机推荐
- A program to print Fahrenheit-Celsius table with floating-point values
我的主力博客:半亩方塘 Another program to print Fahrenheit-Celsius table with decimal integer This program is p ...
- python 变量作用域 v.__sizeof__() python 深复制 一切皆对象 尽量减少内存消耗
python 深入理解 赋值.引用.拷贝.作用域 - 江召伟 - 博客园 https://www.cnblogs.com/jiangzhaowei/p/5740913.html a=[1,2,5]b= ...
- projecteuler---->problem=12----Highly divisible triangular number
title: The sequence of triangle numbers is generated by adding the natural numbers. So the 7th trian ...
- Linux/Android——Input系统之InputReader (七)【转】
本文转载自:http://blog.csdn.net/jscese/article/details/42739197 在前文Linux/Android——Input系统之frameworks层Inpu ...
- 美国诚实签经验——我们准备了XX万的存款,这足以应付我预算表中涉及的所有开支,如果有意外情况我们的资金不足以应付,我们双方的父母也会支援我们,绝对不会占用美国的任何福利
闲话少絮,直接分享本人诚实签的经验,希望对有此打算的朋友有帮助! 个人经验有限,经历仅供参考~~ 第一步:决定赴美生子. 第二步:选择诚实签. 第三步:填写DS160表格(网址https://ceac ...
- loj 6034 线段游戏
题目大意: 给出若干条线段,用 (x1,y2),(x2,y2) 表示其两端点坐标,现在要求支持两种操作: 0 x1 y1 x2 y2 表示加入一条新的线段 (x1,y2),(x2,y2) 1 x0 询 ...
- 5 Application 对象
5.1鸟瞰Application对象 5.2 必须了解的面向显示特性 5.2.1 使用ScreenUpdating改进和完善执行性能 代码清单5.1:实现屏幕更新的性能 '代码清单5.1: 实现屏幕更 ...
- HTTP请求错误码大全(转)
一些常见的状态码为: 200 - 服务器成功返回网页 404 - 请求的网页不存在 503 - 服务不可用 详细分解: 1xx(临时响应) 表示临时响应并需要请求者继续执行操作的状态代码. 代码 说明 ...
- [转]使用git进行版本控制
使用git进行版本控制 本文将介绍一种强大的版本控制工具,git的基本使用.与之前svn工具类似,首先给出一些常见的使用需求,然后以这些需求为中心,来展开git的学习过程.由于我也是在学习当中所以其中 ...
- mysql数据类型和java对应表(copy)
[说明] 资料来自:http://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-type-conversions.html My ...