First, ScrollView common methods and properties
@property (nonatomic) Cgpoint contentoffset;
Set the offset of the scroll
@property (nonatomic) cgsize contentsize;
Setting the slide area
@property (nonatomic,assign) id<uiscrollviewdelegate> delegate;
Set up a proxy for Uiscrollview
@property (nonatomic,getter=isdirectionallockenabled) BOOL directionallockenabled;
Setting whether to lock, this property is very interesting, the default is no, when set to Yes, your scrolling view can only scroll in one Direction at the same time, but when you drag from the diagonal, it is always in the horizontal and vertical direction simultaneously scrolling.
@property (nonatomic) BOOL bounces;
Set whether the rebound effect is turned on
@property (nonatomic) BOOL alwaysbouncevertical;
Whether to turn on the rebound effect in the vertical direction
@property (nonatomic) BOOL alwaysbouncehorizontal;
Whether to turn on the rebound effect in the horizontal direction
@property (nonatomic,getter=ispagingenabled) BOOL pagingenabled;
Whether to turn on page flipping effect
@property (nonatomic,getter=isscrollenabled) BOOL scrollenabled;
Set whether you can slide
@property (nonatomic) BOOL showshorizontalscrollindicator;
Sets whether to show the horizontal slide bar
@property (nonatomic) BOOL showsverticalscrollindicator;
Set whether to show vertical sliders
@property (nonatomic) uiedgeinsets scrollindicatorinsets;
Set the position of the slider bar
@property (nonatomic) Uiscrollviewindicatorstyle Indicatorstyle;
To set the slider style, enumerate the following:
?
| 12345 |
typedefNS_ENUM(NSInteger, UIScrollViewIndicatorStyle) { UIScrollViewIndicatorStyleDefault, //默认 UIScrollViewIndicatorStyleBlack, //黑色风格 UIScrollViewIndicatorStyleWhite //白色风格}; |
@property (nonatomic) cgfloat decelerationrate;
Set sliding speed
-(void) Setcontentoffset: (Cgpoint) Contentoffset animated: (BOOL) animated;
Sets the offset of the scrolling view content, which can drive the drawing effect
-(void) scrollRectToVisible: (cgrect) Rect animated: (BOOL) animated;
Set scrolling view to scroll to a visible area to drive the drawing effect
-(void) flashscrollindicators;
Displays a short scrolling indicator
@property (nonatomic,readonly,getter=istracking) BOOL tracking;
Gets whether the user touches the view content
@property (nonatomic,readonly,getter=isdragging) BOOL dragging;
Gets whether the user started dragging the view
@property (nonatomic,readonly,getter=isdecelerating) BOOL decelerating;
Gets whether the view starts slowing down (the user stops dragging but the view is still scrolling)
@property (nonatomic) BOOL delayscontenttouches;
Sets whether the view delays processing touch events (messages are passed to the child view)
@property (nonatomic) BOOL cancancelcontenttouches;
Sets whether to pass the cancel action message to the child view (the default is yes, when ScrollView triggers the event, its child view cannot be triggered, and if set to No, the child view will continue to trigger the event)
-(BOOL) Touchesshouldbegin: (Nsset *) touches withevent: (Uievent *) event Incontentview: (UIView *) view;
-(BOOL) Touchesshouldcancelincontentview: (UIView *) view;
Override these two methods to control the driver view's event response
@property (nonatomic) cgfloat Minimumzoomscale;
Set content minimum zoom ratio
@property (nonatomic) cgfloat Maximumzoomscale;
Set content Maximum zoom ratio
@property (nonatomic) cgfloat Zoomscale;
Set the zoom ratio
-(void) Setzoomscale: (cgfloat) scale animated: (BOOL) animated;
Set the zoom scale, can drive the picture effect
-(void) Zoomtorect: (cgrect) Rect animated: (BOOL) animated;
Set zoom display to an area, can drive the picture effect
@property (nonatomic) BOOL bounceszoom;
Sets whether rebound can be scaled
@property (nonatomic,readonly,getter=iszooming) BOOL zooming;
Gets whether the mode is being scaled
@property (nonatomic,readonly,getter=iszoombouncing) BOOL zoombouncing;
Gets whether the current zoom scale exceeds the set peak value
@property (nonatomic) BOOL scrollstotop;
Sets whether to scroll to the top of the ScrollView by clicking the status bar
@property (nonatomic) Uiscrollviewkeyboarddismissmode Keyboarddismissmode;
To set the mode for the keyboard to disappear, enumerate the following:
?
| 12345 |
typedefNS_ENUM(NSInteger, UIScrollViewKeyboardDismissMode) { UIScrollViewKeyboardDismissModeNone, UIScrollViewKeyboardDismissModeOnDrag, //手指滑动视图键盘就会消失 UIScrollViewKeyboardDismissModeInteractive, //手指滑动视图后可以与键盘交互,上下滑动键盘会跟随手指上下移动}; |
Second, common methods in Scrollviewdelegata
-(void) Scrollviewdidscroll: (Uiscrollview *) ScrollView;
Method triggered when the view has started sliding
-(void) Scrollviewdidzoom: (Uiscrollview *) ScrollView;
Method that is triggered when the view has started scaling
-(void) scrollviewwillbegindragging: (Uiscrollview *) ScrollView;
Method triggered when the view starts dragging
-(void) scrollviewwillenddragging: (Uiscrollview *) ScrollView withvelocity: (cgpoint) Velocity targetcontentoffset: ( InOut cgpoint *) Targetcontentoffset;
-(void) scrollviewdidenddragging: (Uiscrollview *) ScrollView willdecelerate: (BOOL) decelerate;
method to trigger when view drag ends
-(void) scrollviewwillbegindecelerating: (Uiscrollview *) ScrollView;
Method triggered when the view starts to decelerate
-(void) scrollviewdidenddecelerating: (Uiscrollview *) ScrollView;
Method triggered at end of view deceleration
-(void) Scrollviewdidendscrollinganimation: (Uiscrollview *) ScrollView;
Method triggered at the end of the view animation, using the Set method to set the offset back to trigger
-(UIView *) Viewforzoominginscrollview: (Uiscrollview *) ScrollView;
Return to the Zoomed view
-(void) scrollviewwillbeginzooming: (Uiscrollview *) ScrollView Withview: (uiview*) view;
The method that fires when the view content is about to start scaling
-(void) scrollviewdidendzooming: (Uiscrollview *) ScrollView Withview: (UIView *) View Atscale: (cgfloat) scale;
method to trigger when view content ends scaling
-(BOOL) Scrollviewshouldscrolltotop: (Uiscrollview *) ScrollView;
Returns Yes, opens the shortcut scroll back to the top, and calls when it will scroll
-(void) Scrollviewdidscrolltotop: (Uiscrollview *) ScrollView;
Called when the View shortcut scrolls back to the top start action
Common properties and methods for iOS development Uiscrollview