影响 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的命名 ...
随机推荐
- CentOS7安装MySQL8.0图文教程
1.下载 MySQL 所需要的安装包 网址:https://dev.mysql.com/downloads/mysql/ 2.Select Operating System: 选择 Red Hat , ...
- Making every developer more productive with Visual Studio 2019
Today, in the Microsoft Connect(); 2018 keynote, Scott Guthrie announced the availability of Visual ...
- 「NOI2013」树的计数 解题报告
「NOI2013」树的计数 这什么神题 考虑对bfs重新编号为1,2,3...n,然后重新搞一下dfs序 设dfs序为\(dfn_i\),dfs序第\(i\)位对应的节点为\(pos_i\) 一个暴力 ...
- MATLAB-离散系统的数字PID控制仿真
%PID Controller clear all; close all; ts=0.001; %采样时间=0.001s sys=tf(,]); %建立被控对象传递函数 dsys=c2d(sys,t ...
- MySQL单表查询
MySQL之单表查询 创建表 # 创建表 mysql> create table company.employee5( id int primary key AUTO_INCREMENT not ...
- GWAS研究中case和control的比例是有讲究的?
GWAS研究中,表型分两种.第一种是线性的表型,如果身高.体重.智力等:第二种是二元的表型,比如患病和未患病,即通常所说的case和control.对于表型是线性的样本来说,是不存在case和cont ...
- Unity 子弹移动以及碰撞条件
一.子弹移动 游戏物体移动最主要的是获取一个刚体组件,再对这个刚体组件添加一个向前的力: 具体代码: public class BulletCtrl : MonoBehaviour { ; publi ...
- android studio 报红解决
/Users/houzhibin/gradle/wrapper/dists/gradle-4.1-all/bzyivzo6n839fup2jbap0tjew/gradle-4.1-all.zip
- 细说java系列之HashMap原理
目录 类图 源码解读 总结 类图 在正式分析HashMap实现原理之前,先来看看其类图. 源码解读 下面集合HashMap的put(K key, V value)方法探究其实现原理. // 在Hash ...
- 理解Java的NIO
同步与阻塞 同步和异步是针对应用程序和内核的交互而言的. 同步:执行一个操作之后,进程触发IO操作并等待(阻塞)或者轮询的去查看IO的操作(非阻塞)是否完成,等待结果,然后才继续执行后续的操作. 异步 ...