iOS开发:关于automaticallyAdjustsScrollViewInsets的使用和注意事项
来源:互联网 发布:linux date 北京时间 编辑:程序博客网 时间:2024/06/14 05:00
在iOS开发过程中,使用比较广泛的几个UI控件就包含有UICollectionView、UITableView和UIScrollView。其中UIScrollView是UICollectionView和UITableView的父类,也就是说UICollectionView、UITableView都继承于UIScrollView,因此节省了很多时间去自定义来实现一些基本或者酷炫的效果。
关于automaticallyAdjustsScrollViewInsets的使用,本人已经遇到N次这样的场景了,每次都是看到这个属性才恍然大悟,所以我觉得了要记下来,往后如果遇到关于这个automaticallyAdjustsScrollViewInsets的使用场景,不要犹豫,果断使用它就行。
查看了automaticallyAdjustsScrollViewInsets的官方API解释,它是一个BOOL类型的,是UIViewController的一个属性,这样会导致UIViewController下如果只有一个下面UIScrollView或者其子类,就会自动留出空白,让UIScrollView滚动经过各种bar下面的时候能够隐约看到内容。但是每个UIViewController只能有唯一一个UIScrollView或者其子类,如果超过一个,就需要将automaticallyAdjustsScrollViewInsets设置为NO,由开发者自己去控制留白及坐标问题。可以先看一下它的官方文档是怎么解释的。
如下所示:
Declaration @property(nonatomic, assign) BOOL automaticallyAdjustsScrollViewInsets;
Description A Boolean value that indicates whether the view controller should automatically adjust its scroll view insets.
The default value of this property is YES, which lets container view controllers know that they should adjust the scroll view insets of this view controller’s view to account for screen areas consumed by a status bar, search bar, navigation bar, toolbar, or tab bar. Set this property toNO if your view controller implementation manages its own scroll view inset adjustments.
Availability iOS (7.0 and later), tvOS(7.0 and later)
Declared In UIKit
More Property Reference
解决方法如下:
- iOS开发:关于automaticallyAdjustsScrollViewInsets的使用和注意事项
- IOS开发中关于automaticallyAdjustsScrollViewInsets属性
- iOS开发-automaticallyAdjustsScrollViewInsets属性
- [IOS 开发] automaticallyAdjustsScrollViewInsets属性
- iOS开发-automaticallyAdjustsScrollViewInsets属性
- iOS开发-automaticallyAdjustsScrollViewInsets属性
- iOS automaticallyAdjustsScrollViewInsets和translucent的详解
- 关于automaticallyAdjustsScrollViewInsets和 edgesForExtendedLayout的理解
- 关于edgesForExtendedLayout和automaticallyAdjustsScrollViewInsets
- iOS的automaticallyAdjustsScrollViewInsets属性
- iOS开发 automaticallyAdjustsScrollViewInsets 属性设置
- iOS开发之AFN的使用和注意事项
- iOS开发-Delegate 代理 使用和注意事项
- iOS的edgesForExtendedLayout、automaticallyAdjustsScrollViewInsets属性
- ios automaticallyAdjustsScrollViewInsets
- iOS automaticallyAdjustsScrollViewInsets(自动调整滚动视图)使用
- iOS中的translucent和automaticallyAdjustsScrollViewInsets用法
- iOS中的translucent和automaticallyAdjustsScrollViewInsets用法
- JavaScript学习——对象的创建和继承
- 批量重命名ios图片文件(android不能用@符号)
- Python 标准库 —— zipfile(读取 zip 文件)
- DG计算机视觉公司机试题
- jq实现鼠标放置名字上显示详细内容的气泡效果
- iOS开发:关于automaticallyAdjustsScrollViewInsets的使用和注意事项
- python 中 字符串的应用
- HDU
- at 17:00 Shutdown -s -t 60
- 深入理解拉格朗日乘子法(Lagrange Multiplier) 和KKT条件
- Controlled-Channel Attacks: Deterministic Side Channels for Untrusted Operating Systems
- PHP实现http与https转化
- springmvc返回路径错误的问题
- ESB和SOAP的概念