关于UIScrollView自动调整inset问题
2015-11-26 23:29
465 查看
在项目中遇到一些疑惑,今天刚好发现问题所在,在此记录下来,也希望对看到的人有所帮助。
我们在使用UINavigationController时,当第一个子视图为UIScrollView时会发现UIScrollView会向下偏移,这是因为系统状态栏和我们自己实现的bar(比如navigation bar、toolbar,以及tab bar)会影响滚动视图的布局。默认情况下UIScrollView会自动调整inset,以便应对这些bar元件,如果想手动管理UIScrollView的inset,只需要在对应的
UIViewController中设置automaticallyAdjustsScrollViewInsets属性为false即可
self.automaticallyAdjustsScrollViewInsets
= false;
下面是不设置automaticallyAdjustsScrollViewInsets属性为false的效果图
另附上设置了automaticallyAdjustsScrollViewInsets为false的效果图
我们在使用UINavigationController时,当第一个子视图为UIScrollView时会发现UIScrollView会向下偏移,这是因为系统状态栏和我们自己实现的bar(比如navigation bar、toolbar,以及tab bar)会影响滚动视图的布局。默认情况下UIScrollView会自动调整inset,以便应对这些bar元件,如果想手动管理UIScrollView的inset,只需要在对应的
UIViewController中设置automaticallyAdjustsScrollViewInsets属性为false即可
self.automaticallyAdjustsScrollViewInsets
= false;
下面是不设置automaticallyAdjustsScrollViewInsets属性为false的效果图
另附上设置了automaticallyAdjustsScrollViewInsets为false的效果图
相关文章推荐
- requestAnimationFrame--进度条
- UIScrollView && UITableView相关属性汇总(2013)
- UIScrollView和UITableView总结
- UITableView tableHeaderView autolayout自动计算高度
- UITableView使用详解
- [leetcode]Implement Queue using Stacks
- UIAlertView弹出框
- Android Uiautomator工具使用
- UIActionSheet底部弹出框
- IOS之UILabel添加下划线
- GUI Frame(一)
- iPhone的UITextField-更改占位符文本颜色
- SPOJ LIS2 Another Longest Increasing Subsequence Problem 三维偏序最长链 CDQ分治
- mybatis:java.lang.IllegalArgumentException:Parameter Maps collection does notcontain value for ...
- 读书笔记--其他UI组件
- 108 Which two statements are true about the Automatic Diagnostic Repository (ADR)? (Choose two.) A.
- UIScrollView视差模糊效果
- Android官方文档翻译 五 1.3Building a Simple User Interface
- QUESTION 105 Examine the following RMAN script: RMAN> run { debug on; allocate channel c1 type disk;
- UI错误集