In the process of ios design, the control of UIScrollView is not strange to developers. When dealing with UI interface, we often use UIScrollView. Since UIScrollView is used, Several proxy methods of UIScrollView will inevitably be used. This article does not cover the properties of UIScrollView, but a few proxy methods.

/ This method will be called multiple times as the scrollView slides, / (void)scrollViewDidScroll:(UIScrollView *)scrollView { NSLog(@”scrollViewDidScroll”); }

/* last called in (void)scrollViewDidScroll:(UIScrollView)scrollView; After/(void) scrollViewDidEndDecelerating: (UIScrollView *) scrollView {NSLog (@ “scrollViewDidEndDecelerating”); }

/ this method is invoked when will start to slow down at the end of the drag/(void) scrollViewDidEndDragging: UIScrollView scrollView willDecelerate: (BOOL) decelerate { NSLog(@”scrollViewDidEndDragging:(UIScrollView )scrollView willDecelerate”); }

/* this method is not called when manually sliding, only when (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated; (void)scrollRectToVisible:(CGRect) animated:(BOOL)animated; Calls after calls * / (void) scrollViewDidEndScrollingAnimation: (scrollView UIScrollView *) { NSLog(@”scrollViewDidEndScrollingAnimation”); }

/ this method is called at the beginning of the deceleration, drag again sliding is called first/(void) scrollViewWillBeginDecelerating: (scrollView UIScrollView *) { NSLog(@”scrollViewWillBeginDecelerating”); }

/ (void)scrollViewDidZoom (UIScrollView *)scrollView {NSLog(@”scrollViewDidZoom”); / (void)scrollViewDidZoom (UIScrollView *); }

/ / scroll to the top ((BOOL) scrollViewShouldScrollToTop: (UIScrollView *) scrollView {return YES; Returns yes when call} / scroll to the top of the agent (void) scrollViewDidScrollToTop: (UIScrollView *) scrollView {NSLog (@ “scrollViewDidScrollToTop”); }

/ This method is called at the start of a drag, once per drag, Not touch will not be called/(void) scrollViewWillBeginDragging: (UIScrollView *) scrollView {NSLog (@ “scrollViewWillBeginDragging”); }

/ This method is called when scale starts, To call a/a scale (void) scrollViewWillBeginZooming: UIScrollView scrollView withView: (UIView) view { NSLog(@”scrollViewWillBeginZooming”); }

/ Pay special attention to this method. This method can be used to determine the direction of sliding. TarContentOffset slide can be used to determine whether will have pages (void) scrollViewWillEndDragging: UIScrollView scrollView withVelocity (CGPoint) velocity targetContentOffset:(inout CGPoint )targetContentOffset { NSLog(@”targetContentOffset”); }

After/zoom is called, So we can use atScale to get the zoom value and then we can go further/(void)scrollViewDidEndZooming:(UIScrollView)scrollView withView:(UIView)view atScale:(CGFloat)scale { NSLog(@”atScale”); }

/ / this method can set the scale of the view (nullable UIView) viewForZoomingInScrollView: UIScrollView scrollView {the if (scrollView = = self.myScrollView2) { NSLog(@”hahah”); return self.Views[0]; } return nil; }