工作中碰到的一些小的知识总结一下: 1.self.automaticallyAdjustsScrollViewInsets = NO; // 解决scrollView自动调节contentInset的问题 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 to NO if your view controller implementation manages its own scroll view inset adjustments. 这个属性的默认值是YES的,这让容器视图控制器知道他们应该调整滚动视图insets来让视图控制器的视图被一个状态栏,搜索栏,导航栏,工具栏,或标签栏占据屏幕区域。如果你的视图控制器实现自己管理滚动视图inset,设置该属性NO。 如果你在控制器中有设置 status bar, search bar, navigation bar, toolbar, or tab bar这些控件,且self.automaticallyAdjustsScrollViewInsets = YES的话,系统会自动调整contentInset。 2.contentSize 是scrollview中的一个属性,它代表scrollview中的可显示区域,假如有一个scrollview,它的frame为(0,0,320,480),而它的contentSize为(320,960).也就是说,这个scrollview整个内容的大小为(320,960),要通过上下滑动scrollview来查看(320,480)后的内容。 contentOffset 是scrollview当前显示区域顶点相对于frame顶点的偏移量,比如上个例子你拉到最下面,contentoffset就是(0 ,480),也就是y偏移了480。 contentInset 是scrollview中contentView.frame.origin与scrollview.frame.origin的关系,比如contentView的frame为(0,30,320,480),那么contentInset则为(0, 30), |
|
来自: 南山岳麓书院 > 《UIScrollView》