iOS6适配iOS7

苹果-ios  /  houtizong 发布于 2年前   128

IOS7状态栏StatusBar官方标准适配方法
http://blog.csdn.net/rhljiayou/article/details/12029927

ios7程序界面与状态栏重叠问题解决方案

- (void) viewDidLayoutSubviews {    CGRect viewBounds = self.view.bounds;    CGFloat topBarOffset = self.topLayoutGuide.length;    viewBounds.origin.y = topBarOffset * -1;    self.view.bounds = viewBounds;}

 


(ios7) 解决代码布局View, ios7 中 subView 高度增加StatusBar20dp的问题,保证Ios6,ios7代码一致

在ios7 布局中,Status Bar 和 ToolBar ,NavigateBar 等都包含在ViewControl的主View中。
这样原来ios6 的View布局 整体向上移动了20dp,下面是保证ios6,ios7代码一致的解决方案

1 第一步 在项目的Info.plist 文件中 添加一行属性配置

View controller-based status bar appearance =NO

 
这个设置为:View Controller 不对status Bar 显示进行操作

2 第二步  在AppDelegate.m 文件中,

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

 
添加

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        self.window.bounds = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height);    }

判断为Ios7  ,更新 window.frame

 

请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!

留言需要登陆哦

技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成

网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];

      订阅博客周刊 去订阅

文章归档

文章标签

友情链接

Auther ·HouTiZong
侯体宗的博客
© 2020 zongscan.com
版权所有ICP证 : 粤ICP备20027696号
PHP交流群 也可以扫右边的二维码
侯体宗的博客