#pragma mark-uiscrollviewdelegate commissioned
1. When ScrollView scrolls, the method is called. This method is called by any change in the value of offset. That is, during scrolling, multiple calls are made
// scrollview when scrolling , the method is called. This method is called by any change in the value of offset. That is, during scrolling, the call is repeated -(void ) Scrollviewdidscroll: (Uiscrollview *) scrollview{NSLog ( @ " Scrollviewdidscroll ); Cgpoint Point =scrollview.contentoffset; NSLog ( @ " %f,%f " ,point.x,point.y); // from which you can read the Contentoffset property to determine where it is scrolled. // note: When the Contentsize attribute is less than frame, the scroll will not be set }
2. Call this method when the ScrollView is scaled. Calls back multiple times during the scaling process
// This method is called when the ScrollView is scaled. During scaling, call back multiple times -(void) Scrollviewdidzoom: (Uiscrollview *) scrollview{ NSLog (@ " Scrollviewdidscroll " ); float value=scrollview.zoomscale; NSLog (@ "%f", Value);}
3. The method is executed when the view is started scrolling. An effective slide (start sliding, slide a short distance, as long as the finger does not release, only one slide), only one time
// The method is executed when the view is started scrolling. An effective slide (start sliding, slide a short distance, as long as the finger does not release, only one slide), only one time. -(void) scrollviewwillbegindragging: (Uiscrollview *) scrollview{ NSLog (@ " Scrollviewwillbegindragging");}
4, Slide ScrollView, and the finger to leave when the execution. One effective swipe, only once
// Slide the ScrollView and the finger is left to execute. A valid slide, executed only once. // when the Pagingenabled property is yes, it is not called, the method -(void) scrollviewwillenddragging: (Uiscrollview * ) ScrollView withvelocity: (cgpoint) Velocity targetcontentoffset: (inout cgpoint *) targetcontentoffset{ NSLog (@ "scrollviewwillenddragging");}
5, Slide The view, when the finger leaves the screen that moment, call the method. One effective swipe, only once
//Slide The view, call the method when the finger leaves the screen that moment. A valid slide, executed only once. //decelerate, refers to, when our fingers leave that moment, whether the view will also continue to scroll forward (some distance), tested, Decelerate=yes- (void) Scrollviewdidenddragging: (Uiscrollview *) ScrollView willdecelerate: (BOOL) decelerate{NSLog (@"scrollviewdidenddragging"); if(decelerate) {NSLog (@"decelerate"); }Else{NSLog (@"no decelerate"); } cgpoint Point=Scrollview.contentoffset; NSLog (@"%f,%f", Point.x,point.y);}
6. Call this method when sliding deceleration
// This method is called when the slide slows down. -(void) scrollviewwillbegindecelerating: (Uiscrollview *) scrollview{ NSLog (@ " scrollviewwillbegindecelerating " ); // the method is followed by the Scrollviewdidenddragging method. }
7. When the scrolling view slows down, the method is called when the scroll stops. One effective swipe, only once
// The method is called when the scrolling view slows down and the scroll stops. A valid slide, executed only once. -(void) scrollviewdidenddecelerating: (Uiscrollview *) scrollview{ NSLog (@ " scrollviewdidenddecelerating " ); [_scrollview setcontentoffset:cgpointmake (0) Animated:yes];}
8, when the scrolling view animation is completed, call the method, if there is no animation, then the method will not be called
// when the scrolling view animation is complete, the method is called, and if there is no animation, then the method will not be called -(void) Scrollviewdidendscrollinganimation: (Uiscrollview * ) scrollview{ NSLog (@ "scrollviewdidendscrollinganimation"); // the effective animation methods are: // -(void) Setcontentoffset: (Cgpoint) Contentoffset animated: (BOOL) Animated method // -(void) scrollRectToVisible: (cgrect) Rect animated: (BOOL) animated method }
9. Returns the UIView object that will be scaled. To perform multiple
// returns the UIView object that will be scaled. To execute multiple times -(UIView *) Viewforzoominginscrollview: (Uiscrollview *) scrollview{ NSLog (@ " Viewforzoominginscrollview"); return Self.imgview;}
10. Execute this method when you are about to start scaling. Once a valid scale is performed only once
// The method is executed when the scaling is about to begin. Once a valid scaling is performed. -(void) scrollviewwillbeginzooming: (Uiscrollview *) ScrollView Withview: (UIView *) view{ NSLog (@ "scrollviewwillbeginzooming");}
11, when the zoom is finished, and the scaling is small back to Minimumzoomscale and Maximumzoomscale (we may exceed the zoom range), call the method
// This method is called when the scaling is finished and the zoom is small back to Minimumzoomscale and Maximumzoomscale (we may go beyond the zoom range). -(void) scrollviewdidendzooming: (Uiscrollview *) ScrollView Withview: (UIView *) View Atscale: (float ) scale{ NSLog (@ "scrollviewdidendzooming");}
12 . Indicates whether scrolling view can scroll to the top when the user taps the status bar. You need to set the properties of the scrolling view: _scrollview.scrollstotop=yes
// Indicates whether scrolling the view scrolls to the top when the user taps the status bar. You need to set the properties of the scrolling view: _scrollview.scrollstotop=yes; -(BOOL) Scrollviewshouldscrolltotop: (Uiscrollview *) scrollview{ return YES;
13. When scrolling view is scrolled to the top, execute the method
// when the scrolling view is scrolled to the top, the method is executed -(void) Scrollviewdidscrolltotop: (Uiscrollview *) scrollview{ NSLog (@ "scrollviewdidscrolltotop");}
IOS Uiscrollviewdelegate Detailed