关于IOS7上导航栏遮盖状态栏的问题,以及解决方案
2013-09-25 13:13
363 查看
最近为IOS7升级app,遇到了状态栏被导航栏遮住的问题,拿出来分享一下。 这里说的是UINavigationBar,自定义的不用看了
绝大多数情况下,只要用下面这句话就搞定了
self.navigationController.navigationBar.translucent = NO;
但这次遇到了奇怪的问题,起因是在iPad上用了split view,并且设置了UINavigationBar的background image,现象为状态栏一直是一片漆黑
经过多方排查和查找资料,发现这么一句。
UINavigationController will alter the height of its UINavigationBar to either 44 points or 64 points, depending on a rather strange and undocumented set of constraints. If the UINavigationController detects that the top of its view’s frame is visually contiguous
with its UIWindow’s top, then it draws its navigation bar with a height of 64 points. If its view’s top is not contiguous with the UIWindow’s top (even if off by only one point), then it draws its navigation bar in the “traditional” way with a height of 44
points. This logic is performed by UINavigationController even if it is several children down inside the view controller hierarchy of your application. There is no way to prevent this behavior.
意思就是UINavigationBar的高度会自行调整为44或者64,没有确定的预测方法。而之前作为UINavigationBar背景的图片是44高度的。最后换了张64高度,上面留了20px透明的图片搞定
绝大多数情况下,只要用下面这句话就搞定了
self.navigationController.navigationBar.translucent = NO;
但这次遇到了奇怪的问题,起因是在iPad上用了split view,并且设置了UINavigationBar的background image,现象为状态栏一直是一片漆黑
经过多方排查和查找资料,发现这么一句。
UINavigationController will alter the height of its UINavigationBar to either 44 points or 64 points, depending on a rather strange and undocumented set of constraints. If the UINavigationController detects that the top of its view’s frame is visually contiguous
with its UIWindow’s top, then it draws its navigation bar with a height of 64 points. If its view’s top is not contiguous with the UIWindow’s top (even if off by only one point), then it draws its navigation bar in the “traditional” way with a height of 44
points. This logic is performed by UINavigationController even if it is several children down inside the view controller hierarchy of your application. There is no way to prevent this behavior.
意思就是UINavigationBar的高度会自行调整为44或者64,没有确定的预测方法。而之前作为UINavigationBar背景的图片是44高度的。最后换了张64高度,上面留了20px透明的图片搞定
相关文章推荐
- 关于ios7 以上版本 view被导航栏遮挡的问题 解决方案
- 【Android学习】关于Android4.4沉浸模式的进入和退出时系统栏状态栏遮盖问题
- iOS导航栏变高、状态栏字体变大问题的分析以及解决办法
- 关于适配ios7系统对导航栏的适配问题
- 关于集成ibatIS框架后 jdk版本升级引起的问题以及解决方案
- 升级xcode5 ios7 后状态栏被导航栏遮挡的解决方案
- 有关于面试常遇到的问题回答,以及解决方案。
- 关于session过期返回主页解决方案之一以及js中的“和'使用问题
- IOS7改变状态栏文字的颜色以及导航栏背景颜色
- 关于CSV文件导入到数据的方法以及遇到的问题和解决方案
- 关于Android Studio 更新到3.0版本以后出现的一些问题以及解决方案
- 关于IOS7以及向下兼容音量控制问题
- IOS7之后的导航栏遮盖问题
- IOS7改变状态栏文字的颜色以及导航栏背景颜色
- 关于调用FTP中遇到的问题以及解决方案
- 关于无法加载已创建的布局文件的问题的解决方案以及已布局在对应的R文件中未生成相应ID的问题的解决
- 关于Sybase ASE数据库的license以及试用版过期的问题的解决方案
- 关于 android This window was lost 问题以及解决方案
- 转:iOS7导航栏遮盖问题的解决
- 关于Sybase ASE数据库的license以及试用版过期的问题的解决方案