一 Status bar重叠问题:

Zherui

if ([[[UIDevicecurrentDevice] systemVersion] floatValue] >= 7.0) {

self.window.frame =  CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);

//            self.window.bounds = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height);

UIApplication *myApp = [UIApplicationsharedApplication];

[myApp setStatusBarStyle: UIStatusBarStyleLightContent];

}

然后 View controller-based status bar appearance --> NO

完了

方法一:隐藏Status bar   在plist里面增加2个变量  Status bar is initially hidden  -> YES   View controller-based status bar appearance -> NO

方法二:改为和IOS6 一样的显示方式

  1. Set UIViewControllerBasedStatusBarAppearance to NO in info.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.)

  2. In AppDelegate's application:didFinishLaunchingWithOptions, call

    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); //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 一致了。

iOS7Status bar适配的更多相关文章

  1. iOS6和iOS7代码的适配(2)——status bar

    用Xcode5运行一下应用,第一个看到的就是status bar的变化.在iOS6中,status bar是系统在处理,应用中不需要考虑这部分,iOS7之后是应用在处理,每个ViewControlle ...

  2. ios7适配--隐藏status bar

    //viewDidload if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) { // iOS 7 ...

  3. 【转载】iOS屏幕适配设计

    移动app开发中多种设备尺寸适配问题,过去只属于Android阵营的头疼事儿,只是很多设计师选择性地忽视android适配问题,只出一套iOS平台设计稿.随着苹果发布两种新尺寸的大屏iPhone 6, ...

  4. iOS - 如何切图适配各种机型

    关于iPhone6/6+适配问题一直有争议,今天小编专门为大家整理了相关的有效方案,希望对大伙儿有帮助! 移动app开发中多种设备尺寸适配问题,过去只属于Android阵营的头疼事儿,只是很多设计师选 ...

  5. ios9适配系列教程——ios9新变化

    Demo1_iOS9网络适配_改用更安全的HTTPS iOS9把所有的http请求都改为https了:iOS9系统发送的网络请求将统一使用TLS 1.2 SSL.采用TLS 1.2 协议,目的是 强制 ...

  6. 整理iOS9适配中出现的坑(图文)

    原文: http://www.cnblogs.com/dsxniubility/p/4821184.html 整理iOS9适配中出现的坑(图文)   本文主要是说一些iOS9适配中出现的坑,如果只是要 ...

  7. 如何让你的App适配iOS7?

    随着苹果在2013年9月18日发布iOS7最新的系统以来,iOS各种设备升级到iOS7的数字就已经不断刷新记录.目前据外界统计iOS7设备装机量已经达到2.5亿部,已占iOS设备的64%.由此可见让自 ...

  8. IOS 6和 IOS7适配的一些问题

    由于在做一个ios的通用设计平台,那么客户端解析的时候就涉及到一些ios不同版本,不同分辨率的适配问题 首先碰到的就是navigation bar中的item的背景色的问题 在ios7中设置setti ...

  9. 升级到iOS9之后的相关适配

    iOS9AdaptationTips(iOS9开发学习交流群:458884057) iOS9适配系列教程[中文在页面下方]转自@iOS程序犭袁 (截至2015年9月26日共有10篇,后续还将持续更新. ...

随机推荐

  1. mybatis实战教程(mybatis in action)之四:实现关联数据的查询

    有了前面几章的基础,对一些简单的应用是可以处理的,但在实际项目中,经常是关联表的查询,比如最常见到的多对一,一对多等.这些查询是如何处理的呢,这一讲就讲这个问题.我们首先创建一个Article 这个表 ...

  2. 微软的SQLHelper类(含完整中文注释)

    using System; using System.Data; using System.Xml; using System.Data.SqlClient; using System.Collect ...

  3. STS IDE 个性化修改

    JDK: Eclipse或MyEclipse文件系统不同步的解决方法 STS汉化: 1.解压STS中的language文件夹 以我的安装目录为例,我的STS的安装在D:盘下.将解压后的“languag ...

  4. EMQ 压测问题

    一.单台服务器最高只能跑2W多一点问题描述 一直使用benchmark测试单台EMQ都没有超过3W链接数 一个独立的外网IP只能提供最多6W的端口号,但每个TCP需要分配一个指定的端口号.所以理论上讲 ...

  5. EMQ学习---客户链接资源消耗

    Erlang进程消耗EMQ对客户端链接使用链接进程(emqtt_client)和session进程(emqtt_session)分开的策略. 当一个mqtt的客户端连接到EMQ的服务器上的时候,首先会 ...

  6. Java入门 第一季第二章 变量和常量

    这是我学习慕课网Java课程的笔记.原视频链接为:http://www.imooc.com/learn/85 2-1 Java中的keyword PS:Javakeyword区分大写和小写 2-2 认 ...

  7. Cocos2d-x3.0游戏实例之《别救我》第六篇——从代码中获取UI控件

    这篇的内容非常easy,获取UI控件,然后使用它. 还记得我们在UI编辑器中给三个button分别命名了吧? 如今要用上了. 笨木头花心贡献,啥?花心?不呢,是用心~ 转载请注明,原文地址: http ...

  8. atitit.提升研发管理的利器---重型框架 框架 类库的区别

    atitit.提升研发管理的利器---重型框架 框架 类库的区别 1. 重型框架就是it界的重武器. 1 2. 框架 VS. 库 可视化图形化 1 3. 应用框架 1 4. 类库 2 5. 框架是不可 ...

  9. Spring学习12-Spring利用mock进行单元测试

    一.概述    对于Java组件开发者来说,他们都盼望拥有一组能够对组件开发提供全面测试功能的好用的单元测试.一直以来,与测试独立的Java对象相比,测试传统型J2EE Web组件是一项更为困难的任务 ...

  10. Spring学习9-MyEclipse中Spring工程使用@Resource注释的问题

    在MyEclipse 的Spring工程中,有时候要使用@Resource注释来驱动Spring配置.但是在MyEclipse添加Spring开发能力的操作中,并没有 把相关的库添加到工程的class ...