影响 View 布局区域的有以下三个属性:
self.edgesForExtendedLayout (影响View布局区域的主要属性)
self.navigationController.navigationBar.translucent (navigationBar 是否半透明)
self.tabBarController.tabBar.translucent (tabBar 是否半透明)
-------------------------------------------------------------------------------------
case 1: edgesForExtendedLayout = UIRectEdgeAll
条件: navigationBar.translucent = YES && tabBar.translucent = YES
结果: View Top == navigationBar Top,View Bottom == tabBar Bottom
条件: navigationBar.translucent = NO && tabBar.translucent = YES
结果: View Top == navigationBar Bottom,View Bottom == tabBar Bottom
条件: navigationBar.translucent = YES && tabBar.translucent = NO
结果: View Top == navigationBar Top,View Bottom == tabBar Top
条件: navigationBar.translucent = NO && tabBar.translucent = NO
结果: View Top == navigationBar Bottom,View Bottom == tabBar Top
-------------------------------------------------------------------------------------
case 2: edgesForExtendedLayout = UIRectEdgeTop
条件: navigationBar.translucent = YES && tabBar.translucent = YES
结果: View Top == navigationBar Top,View Bottom == tabBar Top
条件: navigationBar.translucent = NO && tabBar.translucent = YES
结果: View Top == navigationBar Bottom,View Bottom == tabBar Top
条件: navigationBar.translucent = YES && tabBar.translucent = NO
结果: View Top == navigationBar Top,View Bottom == tabBar Top
条件: navigationBar.translucent = NO && tabBar.translucent = NO
结果: View Top == navigationBar Bottom,View Bottom == tabBar Top
-------------------------------------------------------------------------------------
case 3: edgesForExtendedLayout = UIRectEdgeBottom
条件: navigationBar.translucent = YES && tabBar.translucent = YES
结果: View Top == navigationBar Bottom,View Bottom == tabBar Bottom
条件: navigationBar.translucent = NO && tabBar.translucent = YES
结果: View Top == navigationBar Bottom,View Bottom == tabBar Bottom
条件: navigationBar.translucent = YES && tabBar.translucent = NO
结果: View Top == navigationBar Bottom,View Bottom == tabBar Top
条件: navigationBar.translucent = NO && tabBar.translucent = NO
结果: View Top == navigationBar Bottom,View Bottom == tabBar Top
-------------------------------------------------------------------------------------
case 4: edgesForExtendedLayout = UIRectEdgeNone
条件: navigationBar.translucent = YES && tabBar.translucent = YES
结果: View Top == navigationBar Bottom,View Bottom == tabBar Top
条件: navigationBar.translucent = NO && tabBar.translucent = YES
结果: View Top == navigationBar Bottom,View Bottom == tabBar Top
条件: navigationBar.translucent = YES && tabBar.translucent = NO
结果: View Top == navigationBar Bottom,View Bottom == tabBar Top
条件: navigationBar.translucent = NO && tabBar.translucent = NO
结果: View Top == navigationBar Bottom,View Bottom == tabBar Top
-------------------------------------------------------------------------------------
iOS 7.0以后
self.navigationController.navigationBar.translucent 和 self.tabBarController.tabBar.translucent 默认值都为 YES.
iOS 6.0以下系统
navigationBar 和 tabBar 默认都是不透明的。
edgesForExtendedLayout 的枚举项:
UIRectEdgeNone = 0, navBar 底部与 tabBar 上部之间
UIRectEdgeTop = 1 << 0, navBar 上部与 tabBar 上部之间
UIRectEdgeLeft = 1 << 1,
UIRectEdgeBottom = 1 << 2, navBar 底部与 tabBar 底部之间
UIRectEdgeRight = 1 << 3,
UIRectEdgeAll = UIRectEdgeTop | UIRectEdgeLeft | UIRectEdgeBottom | UIRectEdgeRight
下面图中展示了 UIView 的四种情况下的布局区域,绿色为目标 UIView:
View Top == navigationBar Bottom,View Bottom == tabBar Top
View Top == navigationBar Top,View Bottom == tabBar Bottom
View Top == navigationBar Bottom,View Bottom == tabBar Bottom
View Top == navigationBar Top,View Bottom == tabBar Top
注:
本文论证结果是在xcode iOS 12.1 IPhone XR 模拟器上进行的数据校对。
- UIViewController的View显示在导航栏下面如何解决?
ios7之前的版本中UIViewController中的view在显示后会自动调整为去掉导航栏的高度的,控件会自动在导航栏以下摆放. 在iOS7中UIViewController的wantsFullS ...
- iOS-实现映客首页TabBar和滑动隐藏NavBar和TabBar
之前在做直播的时候,参照了映客App,发现其首页的效果还挺不错,在网上找了一下相关仿映客App代码和博客,大部分都是说如何播放直播流和推流,对于UI这块甚少,所以我自己花了点时间研究了一下映客的首页U ...
- Navbar和Tabbar常用设置
1.navBar [self.navigationController.navigationBar setBackgroundImage:navBarImage forBarMetrics:UIBar ...
- Android学习笔记_31_通过后台代码生成View对象以及动态加载XML布局文件到LinearLayout
一.布局文件part.xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android&qu ...
- Change Field Layout and Visibility in a List View 在列表视图中更改字段布局和可见性
This lesson will guide you through the steps needed to select columns displayed in the List View. Fo ...
- 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "XXXView" nib but the view outlet was not set.' 崩溃问题
先说下我遇到这个崩溃问题的原因: 自定义的Viewxib和系统的 View重名,导致崩溃 我的理解是我这里加载YJLoginViewController 的时候,YJLoginViewControll ...
- 怎么让self.view的Y从navigationBar下面开始计算
原文地址 http://blog.sina.com.cn/s/blog_1410870560102wu9a.html 在iOS 7中,苹果引入了一个新的属性,叫做[UIViewController s ...
- UIViewController生命周期-完整版
一.UIViewController 的生命周期 下面带 (NSObject)的方法是NSObject提供的方法.其他的都是UIViewController 提供的方法. load (NSObje ...
- 8. UIViewController
1. UIViewController 的认识 UIViewController在iOS开发中占据很重要的位置,iOS的整个UI开发的核心思想也是MVC的架构,从UIViewController的命名 ...
随机推荐
- bugku web 变量1
flag In the variable ! <?php error_reporting(0);include "flag1.php";highlight_file(__fi ...
- oracle wm_concat 函数无法使用的情况下,使用LISTAGG()函数
http://dacoolbaby.iteye.com/blog/1698957 --20180327 重写wm_concat函数,解决行数超过上限问题 /*执行前请将APPS替换为当前登录用户*/ ...
- C#语法相比其它语言比较独特的地方
C#语法相比其它语言比较独特的地方(一) 本文讲解了switch语句可以用来测试string型的对象.多维数组.foreach语句.索引器和Property等内容 1,switch语句可以用来测试st ...
- 【THUSC2017】【LOJ2978】杜老师 高斯消元
题目大意 给你 \(l,r\),求从 \(l\) 到 \(r\) 这 \(r-l+1\) 个数中能选出多少个不同的子集,满足子集中所有的数的乘积是一个完全平方数. 对 \(998244353\) 取模 ...
- Logback日志基础配置以及自定义配置
Logback日志基础配置 logback日志配置有很多介绍,但是有几个非常基础的,容易忽略的.下面是最简单的一个配置,注意加粗的描述 <?xml version="1.0" ...
- Dlib Python 检测人脸特征点 Face Landmark Detection
首先安装Dlib,Opencv库 Dlib安装链接:http://www.cnblogs.com/as3asddd/p/7237280.html 环境:Mac Sierra 10.12.1 Pytho ...
- 远离go path,弃用go get,使用go mod 进行go语言的学习
标题说的是go语言的学习,因为我也没做过开发 文章要解决的仅仅是一个问题 当你使用go get 无论如何get不到所需的包的问题 第一步就是下载goland 新手极其推荐goland,因为直接使用gl ...
- C#利用 HttpWebRequest 类发送post请求,出现“套接字(协议/网络地址/端口)只允许使用一次”问题
声明:问题虽然已经被解决,但是并没有明白具体原理,欢迎大佬补充. 最近网站出现一个问题,在C#里面使用 HttpWebRequest 类去发送post请求,偶尔 会出现 “套接字(协议/网络地址/端 ...
- 三、Dockerfile的说明和编写
一.docker hub的使用和说明: 我们要去找镜像,一般都会 https://hub.docker.com 的网站中去找,目前linux的容器,我们目前首选是alpine,因为容器非常小,可以满 ...
- npm_config_
npm script时会带一些参数变量,例如: "test": "node scripts/tools/test.js --name=test111" 平常我们 ...