让控制器的view顶到屏幕最上方,也就是状态栏底下

这句代码可以吧view顶到状态栏里面 贴在屏幕最上方


这句代码还会吧view顶到最下方,所以如果项目中是用tabBarController开发的时候

tableview下方总显示不完全,用代码设置偏移量也没用;

官方文档解释如下:
 
 
A Boolean value that indicates whether the view controller should automatically adjust its scroll view insets.
 
Declaration
SWIFT
var automaticallyAdjustsScrollViewInsets: Bool
OBJECTIVE-C
@property(nonatomic, assign) BOOL automaticallyAdjustsScrollViewInsets
Discussion
The default value of this property is YES, which allows the view controller to adjust its scroll view insets in response to the screen areas consumed by the status bar, navigation bar, and toolbar or tab bar. Set to NO if you want to manage scroll view inset adjustments yourself, such as when there is more than one scroll view in the view hierarchy.
 
Availability
Available in iOS 7.0 and later.
简单点说就是automaticallyAdjustsScrollViewInsets根据按所在界面的status bar,navigationbar,与tabbar的高度,自动调整scrollview的 inset,设置为no,不让viewController调整,

所以为了避免出现的问题 可以自己手动设置contentInset 也能达到一样的效果;

posted @ 2016-06-24 19:27  箭过不留痕  阅读(502)  评论(0编辑  收藏  举报