您的位置:首页 > 其它

automaticallyAdjustsScrollViewInsets

2016-04-09 15:57 232 查看
对于automaticallyAdjustsScrollViewInsets 的官方描述是:

automaticallyAdjustsScrollViewInsets

Specifies whether or not the view controller should automatically adjust its scroll view insets.

@property(nonatomic, assign) BOOL automaticallyAdjustsScrollViewInsets

Discussion

Default value 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 toNO 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.//iOS7.0之后的属性!!!

Declared In

UIViewController.h

简单点说就是automaticallyAdjustsScrollViewInsets根据按所在界面的status bar,navigationbar,与tabbar的高度,自动调整scrollview的 inset,设置为no,不让viewController调整。
self.automaticallyAdjustsScrollViewInsets = NO; // scrollview 上的视图view(y+)自动下移navigationbar,与tabbar的高度。(无论这scrollview是否置顶)
自己代码的问题在于自定义了一个 navigationbar ,因而系统自己判断并适配。设置了
automaticallyAdjustsScrollViewInsets 才实现了相应效果。



备注一下UIScrollView的一些属性
常见属性
CGSize contentSize :设置UIScrollView的滚动范围
CGPoint contentOffset :UIScrollView当前滚动的位置
UIEdgeInsets contentInset :这个属性可以在四周增加滚动范围
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: