iOS7Status bar适配
一 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 一样的显示方式
Set
UIViewControllerBasedStatusBarAppearancetoNOininfo.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 一致了。
iOS7Status bar适配的更多相关文章
- iOS6和iOS7代码的适配(2)——status bar
用Xcode5运行一下应用,第一个看到的就是status bar的变化.在iOS6中,status bar是系统在处理,应用中不需要考虑这部分,iOS7之后是应用在处理,每个ViewControlle ...
- ios7适配--隐藏status bar
//viewDidload if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) { // iOS 7 ...
- 【转载】iOS屏幕适配设计
移动app开发中多种设备尺寸适配问题,过去只属于Android阵营的头疼事儿,只是很多设计师选择性地忽视android适配问题,只出一套iOS平台设计稿.随着苹果发布两种新尺寸的大屏iPhone 6, ...
- iOS - 如何切图适配各种机型
关于iPhone6/6+适配问题一直有争议,今天小编专门为大家整理了相关的有效方案,希望对大伙儿有帮助! 移动app开发中多种设备尺寸适配问题,过去只属于Android阵营的头疼事儿,只是很多设计师选 ...
- ios9适配系列教程——ios9新变化
Demo1_iOS9网络适配_改用更安全的HTTPS iOS9把所有的http请求都改为https了:iOS9系统发送的网络请求将统一使用TLS 1.2 SSL.采用TLS 1.2 协议,目的是 强制 ...
- 整理iOS9适配中出现的坑(图文)
原文: http://www.cnblogs.com/dsxniubility/p/4821184.html 整理iOS9适配中出现的坑(图文) 本文主要是说一些iOS9适配中出现的坑,如果只是要 ...
- 如何让你的App适配iOS7?
随着苹果在2013年9月18日发布iOS7最新的系统以来,iOS各种设备升级到iOS7的数字就已经不断刷新记录.目前据外界统计iOS7设备装机量已经达到2.5亿部,已占iOS设备的64%.由此可见让自 ...
- IOS 6和 IOS7适配的一些问题
由于在做一个ios的通用设计平台,那么客户端解析的时候就涉及到一些ios不同版本,不同分辨率的适配问题 首先碰到的就是navigation bar中的item的背景色的问题 在ios7中设置setti ...
- 升级到iOS9之后的相关适配
iOS9AdaptationTips(iOS9开发学习交流群:458884057) iOS9适配系列教程[中文在页面下方]转自@iOS程序犭袁 (截至2015年9月26日共有10篇,后续还将持续更新. ...
随机推荐
- [Asp.net]Calendar+JqueryUi实现日程管理——添加日程
引言 之前在博客园里看到一篇文章,介绍的云日程,所以就一直在想如果是自己该如何实现,所以就自己尝试弄了一个简单的demo. 项目 效果图 日历控件,本来想弄一个js版的,后来考虑,js版的会花费更多的 ...
- android 上下左右手势判断 根据别人的改的
GestureUtils.java package com.gesture; import android.content.Context;import android.util.DisplayMet ...
- bzoj-4003 城池攻占
题意: 给出一个n个结点的有根树,和m个骑士: 树上的结点--城池有一个防御值,骑士有一个战斗力: 当骑士的战斗力大于等于城池时,城池被攻破.骑士的战斗力变化,并向树上的父节点前进: 否则骑士死亡. ...
- LINQ to SQL语句之Select/Distinct和Count/Sum/Min/Max/Avg (转)
Select/Distinct操作符 适用场景:o(∩_∩)o… 查询呗. 说明:和SQL命令中的select作用相似但位置不同,查询表达式中的select及所接子句是放在表达式最后并把子句中的变量也 ...
- JUC组件扩展(三):BlockingQueue(阻塞队列)详解
一. 前言 在新增的Concurrent包中,BlockingQueue很好的解决了多线程中,如何高效安全“传输”数据的问题.通过这些高效并且线程安全的队列类,为我们快速搭建高质量的多线程程序带来极大 ...
- C数组逆序
一.标准交换模式 /**** *标准交换模式 *实现数组的逆序,原理就是数组的首尾元素进行交换 ***/ #define N 5; int main(){ int array[N] = {15,20, ...
- find_if查找vector内对象的成员 作为菜鸟一直不会用也不敢用
用stl的find方法查找一个包含简单类型的vector中的元素是很简单的,例如 vector<string> strVec; find(strVec.begin(),strVec.end ...
- Release Management
1. Understand the current state of release management. test environment limitations how long to setu ...
- ubuntu获取root权限
1.先在Terminal下设置root密码 执行 sudo passwd root 2.执行sudo su,然后根据提示来即可.
- 每日英语:China Targets Big Pharma
China unveiled a litany of bribery and misconduct allegations against GlaxoSmithKline GSK.LN -0.26% ...