1 //2 //UIDEMOVIEWCONTROLLER.M3 //06-1uiscrolldemo4 //5 //Created by K on 14-9-4.6 //Copyright (c) 2014 com.akleee.www. All rights reserved.7 //8 9 #import "UIDemoViewController.h"Ten One @interfaceUidemoviewcontroller () <UIScrollViewDelegate> A@property (Weak, nonatomic) Iboutlet Uiscrollview *Scrollviw; -@property (Weak, nonatomic) Iboutlet Uiimageview *img; - the-(Ibaction) Changeoffset: (ID) sender; - - - @end + - @implementationUidemoviewcontroller + A- (void) Viewdidload at { - [Super Viewdidload]; - //additional setup after loading the view, typically from a nib. - //NSLog (@ "%@", Nsstringfromcgrect (_img.frame)); - - //set up a removable area in_scrollviw.contentsize=_img.bounds.size; - to //Visual Window Position + intmovetop= -, moveleft= -; - the_scrollviw.contentoffset=Cgpointmake (Movetop, moveLeft); * $ //Visual Window SizePanax Notoginseng //int windoww=100,windowh=400,windowx=10,windowy=20; - //_scrollviw.frame=cgrectmake (windowx, Windowy, Windoww, WINDOWH); the + //outer margin A intpaddingt=Ten, paddingl=Ten, paddingr= -, paddingb= -; the +_scrollviw.contentinset=Uiedgeinsetsmake (Paddingt, Paddingl, PADDINGB, Paddingr); - $ //Horizontal scroll bar $ //_scrollviw.showshorizontalscrollindicator=no; - // - // //Vertical scroll bar the //_scrollviw.showsverticalscrollindicator=no; - Wuyi_scrollviw.Delegate=Self ; the -_scrollviw.maximumzoomscale=2; Wu -_scrollviw.minimumzoomscale=0.1; About $ } - - -- (void) didreceivememorywarning A { + [Super didreceivememorywarning]; the //Dispose of any resources the can be recreated. - } $-(void) Scrollviewwillbegindragging: (Uiscrollview *) scrollview{ the //Start dragging the //NSLog (@ "scrollviewwillbegindragging%@", Nsstringfromcgpoint (Scrollview.contentoffset)); the the } --(void) Scrollviewdidscroll: (Uiscrollview *) ScrollView { in //is being dragged and dragged the //NSLog (@ "Scrollviewdidscroll%@", Nsstringfromcgpoint (Scrollview.contentoffset)); the } About the the-(void) Scrollviewdidenddragging: (Uiscrollview *) ScrollView willdecelerate: (BOOL) decelerate{ the //drag and drop end + //NSLog (@ "scrollviewdidenddragging%@", Nsstringfromcgpoint (Scrollview.contentoffset)); - } the Bayi-(void) Scrollviewwillbegindecelerating: (Uiscrollview *) scrollview{ the //start sliding after dragging the //NSLog (@ "scrollviewwillbegindecelerating%@", Nsstringfromcgpoint (Scrollview.contentoffset)); - } --(void) Scrollviewdidenddecelerating: (Uiscrollview *) scrollview{ the the //slide to end after dragging the //NSLog (@ "scrollviewdidenddecelerating%@", Nsstringfromcgpoint (Scrollview.contentoffset)); the - } the-(void) Scrollviewdidscrolltotop: (Uiscrollview *) scrollview{ the //swipe to the bottom to trigger when the top navigation of the system is automatically positioned to the top the //NSLog (@ "Scrollviewdidscrolltotop%@", Nsstringfromcgpoint (Scrollview.contentoffset));94 the } the the 98-(BOOL) Scrollviewshouldscrolltotop: (Uiscrollview *) scrollview{ About //swipe to content below click System Top Navigation -NSLog (@"scrollviewshouldscrolltotop%@", Nsstringfromcgpoint (Scrollview.contentoffset));101 //returns whether to automatically locate to the top102 returnNO;103 }104 the-(void) Scrollviewdidendscrollinganimation: (Uiscrollview *) scrollview{106 //Trigger This event when Trigger [_scrollviw setcontentoffset:cgpointmake (up to Animated:yes)];107 //This event will not be triggered if animated:no.108 //NSLog (@ "Scrollviewdidendscrollinganimation%@", Nsstringfromcgpoint (Scrollview.contentoffset));109 } the 111-(UIView *) Viewforzoominginscrollview: (Uiscrollview *) scrollview{ the //set the UIView to be scaled113 //NSLog (@ "Viewforzoominginscrollview%@", Nsstringfromcgpoint (Scrollview.contentoffset)); the the the return_img;117 118 }119 --(void) Scrollviewwillbeginzooming: (Uiscrollview *) ScrollView Withview: (UIView *) view{121 //Start Scaling122NSLog (@"scrollviewwillbeginzooming");123 124 } the 126-(void) Scrollviewdidendzooming: (Uiscrollview *) ScrollView Withview: (UIView *) View Atscale: (cgfloat) scale127 { - //End Zoom129NSLog (@"scrollviewdidendzooming"); the 131 the }133 134 135 136 137 138-(Ibaction) Changeoffset: (ID) Sender {139NSLog (@"Change offset"); $[_scrollviw Setcontentoffset:cgpointmake ( $, $) Animated:no];141 //_scrollviw. Contentoffset=cgpointmake (a);142 }143 @end
iOS Controls Uiscrollview event description