iOS开发 automaticallyAdjustsScrollViewInsets 属性设置

来源:互联网 发布:java获取所有interface 编辑:程序博客网 时间:2024/05/24 04:20


遇到的问题


苹果官方文档解释是这样的
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调整,如果我们不让它自己调整,这个属性设置为no就行了
即:

    self.automaticallyAdjustsScrollViewInsets =NO;


0 0
原创粉丝点击