@property(nonatomic)
// default CGPointZero。
//在滚轴视图中,contentOffset属性可以跟踪UIScrollView的具体位置,你能够自己获取和设置它,contentOffset的值是你当前可视内容在滚轴视图上面偏移原来的左上角那个点的偏移量,有contentOffset.x和contentOffset.y。
@property(nonatomic)
// default CGSizeZero。
//contentSize是内容的大小,也就是可以滚动的大小。默认是0,没有滚动效果。
@property(nonatomic)
// default UIEdgeInsetsZero. add additional scroll area aroundcontent
//contentInset增加你在contentSize中指定的内容能够滚动的上下左右区域数量。contentInset.top、contentInset.buttom、contentInset.left、contentInset.right分别表示上面,下面,左边和右边的距离。
@property(nonatomic,assign)id<UIScrollViewDelegate>
// default nil. weak reference
//设置代理
@property(nonatomic,getter=isDirectionalLockEnabled
// default NO. if YES, try to lock vertical or horizontal scrollingwhile dragging
//默认是NO,可以在垂直和水平方向同时运动。当值是YES时,假如一开始是垂直或者是水平运动,那么接下来会锁定另外一个方向的滚动。假如一开始是对角方向移动,则不会禁止某个方向。
@property(nonatomic)
// default YES. if YES, bounces past edge of content and backagain
//默认是YES,就是滚动超过边界会反弹,有反弹回来的效果。如果是NO,那么滚动到达边界会立即停止
@property(nonatomic)
@property(nonatomic)
@property(nonatomic,getter=isPagingEnabled)BOOL
// default NO. if YES, stop on multiples of view bounds
//当值是YES会自动滚到subview的边界,默认为NO
@property(nonatomic,getter=isScrollEnabled)BOOL
// default YES. turn off any dragging temporarily
//决定是否可以滚动
@property(nonatomic)
// default YES. show indicator while we are tracking. fades outafter tracking
//滚动时是否显示水平滚动条
@property(nonatomic)
// default YES. show indicator while we are tracking. fades outafter tracking
//滚动时是否显示垂直滚动条
@property(nonatomic)
// default is UIEdgeInsetsZero. adjust indicators inside ofinsets
//设置滚动条的位置
@property(nonatomic)
// default is UIScrollViewIndicatorSty
//滚动条的样式,基本只是设置颜色,总共3个颜色:默认、黑、白。
@property(nonatomic)
//设置手指放开后的减速率
-(void)setContentOffset:(CGPoint)contentOffsetanimated:(BOOL)animated;
// animate at constant velocity to new offset
-(void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated;
// scroll so rect is just visible (nearest edges). nothing if rectcompletely visible
//上面这个两个函数用来自动滚到到想要的位置,此过程中设置有动画效果,停止时,触发该函数。当animated为YES的时候有动画效果
- (void)flashScrollIndicators;
@property(nonatomic,readonly,getter=isTracking)
// returns YES if user has touched. may not yet have starteddragging
//当touch后还没有拖动的时候是YES,否则为NO
@property(nonatomic,readonly,getter=isDragging)
@property(nonatomic,readonly,getter=isDecelerating)BOOL decelerating;
// returns YES if user isn't dragging (touch up) but scroll view isstill moving
//当滚动后,手指放开但是还在继续滚动中。这个时候是YES,其他时候 NO
@property(nonatomic)BOOLdelaysContentTouches;
// default is YES. if NO, we immediately call-touchesShouldBegin:withEvent:inContentView:
//当值是YES的时候,用户触碰开始,scrollview要延迟一会,看看是否用户有意图滚动。假如滚到了,那么捕捉touch-down事件,否则就不捕捉。假如值是NO,当用户触碰,scrollview会立即触发touchesSholdBegin:withEvent:inContentView:。默认为YES。
@property(nonatomic)BOOL canCancelContentTouches;
// default is YES. if NO, then once we start tracking, we don't tryto drag if the touch moves
//当值是YES的时候,用户触碰后,然后在一定时间内没有移动,scrollView发送trackingevents,然后用户移动手指足够长度触发滚动事件,这个时候,scrollview发送了touchesCancelled:withEvent:到subview,然后scrollview开始滚动。假如为NO,scrollview发送trackingevents后,就算用户移动手指,scrollview也不会滚动。
// override points for subclasses to control delivery of touchevents to subviews of the scroll view
// called before touches are delivered to a subview of the scrollview. if it returns NO the touches will not be delivered to thesubview
// default returns YES。决定自己是否接收touch事件
-(BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view;
// called before scrolling begins if touches have already beendelivered to a subview of the scroll view. if it returns NO thetouches will continue to be delivered to the subview and scrollingwill not occur
// not called if canCancelContentTouches is NO. default returns YESif view isn't a UIControl
-(BOOL)touchesShouldCancelInCon
//开始发送trackingmessage消息给subview的时候调用这个方法,决定是否发送trackingmessage消息给subview。假如返回NO,发送,YES则不发送。
@property(nonatomic)float minimumZoomScale;
// default is 1.0。表示能缩最小的倍数
@property(nonatomic)float maximumZoomScale;
// default is 1.0. must be > minimum zoom scale toenable zooming。表示能放最大的倍数
@property(nonatomic)float zoomScale __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);
-(void)setZoomScale:(float)scaleanimated:(BOOL)animated__OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);
-(void)zoomToRect:(CGRect)rect animated:(BOOL)animated__OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);
@property(nonatomic)BOOL
// default is YES. if set, user can go past min/max zoom whilegesturing and the zoom will animate to the min/max value at gestureend
//和bounces类似,区别在于:这个效果反映在缩放方面假如缩放超过最大缩放,那么会有反弹效果;假如是NO,则到达最大或者最小的时候立即停止
@property(nonatomic,readonly,getter=isZooming)
// returns YES if user in zoom gesture。当正在缩放的时候是YES,否则为NO
@property(nonatomic,readonly,getter=isZoomBouncing)
//returns YES if we are in the middle of zooming back to themin/max value。
//当内容放大到最大或者最小的时候值是YES,否则为NO
// When the user taps the status bar, the scroll view beneath thetouch which is closest to the status bar will be scrolled to top,but only if its `scrollsToTop` property is YES, its delegate doesnot return NO from `shouldScrollViewScrollTo
// On iPhone, we execute this gesture only if there's one on-screenscroll view with `scrollsToTop` == YES. If more than one is found,none will be scrolled.
@property(nonatomic)BOOL
// Use these accessors to configure the scroll view's built-ingesture recognizers.
// Do not change the gestures' delegates or override the gettersfor these properties.
@property(nonatomic,readonly) UIPanGestureRecognizer*panGestureRecognizer__OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);
// `pinchGestureRecognizer` will return nil when zooming isdisabled.
@property(nonatomic,readonly) UIPinchGestureRecognizer
@end
@protocolUIScrollViewDelegate<NSObject>
@optional
-(void)scrollViewDidScroll:(UIScrollView*)scrollView;
// any offset changes
//触摸屏幕来滚动画面还是其他的方法使得画面滚动,皆触发该函数
-(void)scrollViewDidZoom:(UIScrollView *)scrollView__OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_2);// any zoom scale changes
// called on start of dragging (may require some time and ordistance to move)
-(void)scrollViewWillBeginDragg
// called on finger up if the user dragged. velocity is inpoints/second. targetContentOffset may be changed to adjust wherethe scroll view comes to rest. not called when pagingEnabled isYES
-(void)scrollViewWillEndDraggin
// called on finger up if the user dragged. decelerate is true ifit will continue moving afterwards
-(void)scrollViewDidEndDragging
//触摸屏幕并拖拽画面,再松开,最后停止时,触发该函数
-(void)scrollViewWillBeginDecel
-(void)scrollViewDidEndDecelera
//滚动停止时,触发该函数
- (void)scrollViewDidEndScrollin
//scrollview还处理缩放和平移手势,要实现缩放和平移,必须实现委托viewForZoomingInScrollVi
- (UIView*)viewForZoomingInScrollVi
-(void)scrollViewWillBeginZoomi
-(void)scrollViewDidEndZooming:(UIScrollView *)scrollViewwithView:(UIView *)viewatScale:(float)scale;// scale between minimum and maximum.called after any 'bounce' animations
- (BOOL)scrollViewShouldScrollTo
- (void)scrollViewDidScrollToTop
@end