首页 技术 正文
技术 2022年11月18日
0 收藏 654 点赞 3,903 浏览 922 个字

在IOS7以后 ViewController 开始使用全屏布局的,而且是默认的行为通常涉及到布局

就离不开这个属性 edgesForExtendedLayout,它是一个类型为UIExtendedEdge的属性,

指定边缘要延伸的方向,它的默认值很自然地是UIRectEdgeAll,四周边缘均延伸,就是说,

如果即使视图中上有navigationBar,下有tabBar,那么视图仍会延伸覆盖到四周的区域。

因为一般为了不让tableView 不延伸到 navigationBar 下面, 属性设置为 UIRectEdgeNone

UIRectEdgeAll — default

[IOS]edgesForExtendedLayout、automaticallyAdjustsScrollViewInsets

UIRectEdgeNone

[IOS]edgesForExtendedLayout、automaticallyAdjustsScrollViewInsets

这时会发现导航栏变灰了,处理如下就OK了

self.navigationController.navigationBar.translucent = NO;

那 automaticallyAdjustsScrollViewInsets 呢?

当 automaticallyAdjustsScrollViewInsets 为 NO 时,tableview 是从屏幕的最上边开始,也就是被

导航栏 & 状态栏覆盖

[IOS]edgesForExtendedLayout、automaticallyAdjustsScrollViewInsets

当 automaticallyAdjustsScrollViewInsets 为 YES 时,也是默认行为,表现就比较正常了,和

edgesForExtendedLayout = UIRectEdgeNone 有啥区别? 不注意可能很难觉察

设计师可能一眼就看穿。。。 automaticallyAdjustsScrollViewInsets 为YES 时,

tableView 上下滑动时,是可以穿过导航栏&状态栏的,在他们下面有淡淡的浅浅红色

[IOS]edgesForExtendedLayout、automaticallyAdjustsScrollViewInsets

extendedLayoutIncludesOpaqueBars

首先看下官方解释,默认 NO, 但是Bar 的默认属性是 透明的。。。也就是说只有在不透明下才有用

但是,测试结果很软肋,基本区别不大。。。但是对于解决一些Bug 是还是起作用的,比如说SearchBar的

跳动问题,详情见:http://www.cnblogs.com/skyming/p/4059128.html, 其他UITableView,UIScrollView 位置的

问题多数和这3属性相关。。

[IOS]edgesForExtendedLayout、automaticallyAdjustsScrollViewInsets

上一篇: UIColor与PatternImage
下一篇: iOS多线程解析
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,077
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,552
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,401
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,176
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,813
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,896