UIScrollView

UIScrollView 的一些特性,记录下
1:tracking
@property(nonatomic,readonly,getter=isTracking) BOOL tracking; // returns YES if user has touched. may not yet have started dragging。
用来返回用户是否已经接触scrollView 但可能还没有开始滚动

返回YES表示用户手指一直接触着scrollView(包括手指一直拖动scrollView)没有松开 返回NO表示手指离开scrollView 此时scrollView做自由滚动

链接:https://www.jianshu.com/p/9436c9a2cd1e

2:dragging
@property(nonatomic,readonly,getter=isDragging) BOOL dragging; // returns YES if user has started scrolling. this may require some time and or distance to move to initiate dragging
可以理解为,用户在拖拽当前视图滚动(手一直拉着)

3:decelerating
@property(nonatomic,readonly,getter=isDecelerating) BOOL decelerating; // returns YES if user isn't dragging (touch up) but scroll view is still moving
可以理解为用户手已放开,是否是否还在滚动(是否惯性效果)
if (scrollView.isTracking || scrollView.isDecelerating)
用来判断是否是用户的操作。
4:pagingEnabled
@property(nonatomic,getter=isPagingEnabled) BOOL pagingEnabled API_UNAVAILABLE(tvos);// default NO. if YES, stop on multiples of view bounds
是否滑动一整页

5:contentOffset
@property(nonatomic) CGPoint contentOffset; // default CGPointZero设置scrollerview的位置不动,contentOffset.y=内容的顶部和frame顶部的差值

6:contentInset
@property(nonatomic) UIEdgeInsets contentInset; // default UIEdgeInsetsZero. add additional scroll area around content
设置内边距
7:contentSize
设置滑动的区域。
参考:https://www.jianshu.com/p/5e5d8933cd51

你可能感兴趣的:(UIScrollView)