@optional
- (void)scrollViewDidScroll:(UIScrollView *)scrollView;
- (void)scrollViewDidZoom:(UIScrollView *)scrollView __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_2); // view的缩放,参考另一篇博文---any zoom scale changes
// called on start of dragging (may require some time and or distance to move)
// 将要开始拖拽,手指已经放在view上并准备拖动的那一刻
- (void)scrollViewWillBeginDragg
// called on finger up if the user dragged. velocity is in points/second. targetContentOffset may be changed to adjust where the scroll view comes to rest. not called when pagingEnabled is YES
// 将要结束拖拽,手指已拖动过view并准备离开手指的那一刻
- (void)scrollViewWillEndDraggin
// called on finger up if the user dragged. decelerate is true if it will continue moving afterwards
// 已经结束拖拽,手指刚离开view的那一刻
- (void)scrollViewDidEndDragging
// called on finger up as we are moving
//
- (void)scrollViewWillBeginDecel
// called when scroll view grinds to a halt
// view已经停止滚动
- (void)scrollViewDidEndDecelera
// called when setContentOffset/scrollRectVisible:animated: finishes. not called if not animating
// 有动画时调用
- (void)scrollViewDidEndScrollin
// return a view that will be scaled. if delegate returns nil, nothing happens
// 直接看英文吧
- (UIView *)viewForZoomingInScrollVi
// called before the scroll view begins zooming its content
- (void)scrollViewWillBeginZoomi
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale;
// return a yes if you want to scroll to the top. if not defined, assumes YES
- (BOOL)scrollViewShouldScrollTo
// called when scrolling animation finished. may be called immediately if already at top
- (void)scrollViewDidScrollToTop
@end
执行顺序:
willBeginDragging
DidScroll
willEndDragging
DidEndDragging
DidScroll
willBeginDecelerating
DidScroll
DidEndDecelerating
#define DELEGATE_CALLBACK(DELEGATE, SEL) if (DELEGATE && [DELEGATE respondsToSelector:@selector(SEL)]) [DELEGATE performSelector:@selector(SEL)]
#define DELEGATE_CALLBACK_ONE_PARAMETER(DELEGATE, SEL, X) if (DELEGATE && [DELEGATE respondsToSelector:@selector(SEL)]) [DELEGATE performSelector:@selector(SEL) withObject:X]
#define DELEGATE_CALLBACK_TWO_PARAMETER(DELEGATE, SEL, X, Y) if (DELEGATE && [DELEGATE respondsToSelector:@selector(SEL)]) [DELEGATE performSelector:@selector(SEL) withObject:X withObject:Y]