Properties
Alwaysbouncehorizontal//A Boolean value that determines whether bouncing always occurs when horizontal scrolling reaches the end of the view. The default value is No.
@property (nonatomic) BOOL alwaysbouncehorizontal//If this property is set to Yes and the value of bounces is yes, horizontal drag is what is allowed, even if it is less than the bounds of the scrolling view. The default value is no
Alwaysbouncevertical//A Boolean value that determines whether the bounce always occurs when the vertical scroll reaches the end of the content. The default value is No.
@property (nonatomic) BOOL alwaysbouncevertical////If this property is set to Yes and the value of bounces is yes, dragging vertically is allowed, even if it is less than the bounds of the scrolling view. The default value is no
Bounces//Controls whether scrolling view bounces past the edges of the content, and then returns a Boolean value.
@property (nonatomic) BOOL bounces//The default value is yes.
Bounceszoom//A Boolean value that determines whether scrolling the view pushes the content to zoom when the scale exceeds the upper or lower bounds.
@property (nonatomic) BOOL bounceszoom//If the value of this property is Yes and zoom zoom exceeds the upper or lower limit, return them before scrolling the view to temporarily scale the content. If this property is no, immediately stop scaling in one scale limit. The default is yes.
Cancancelcontenttouches//A Boolean value that controls whether the content view involved always results in a trace.
@property (nonatomic) BOOL cancancelcontenttouches
The distance from the Contentinset//content view is illustrated from the closed scrolling view.
@property (nonatomic) uiedgeinsets Contentinset//Use this property to add content to the surrounding scrolling area. The unit of size is the point. The default value is Uiedgeinsetszero.
At which point the content view originates from the scroll view's origin offset to monitor the current scrolling position
@property (nonatomic) cgpoint contentoffset//default value is Cgpointzero
The size of the contentsize//content view.
@property (nonatomic) cgsize contentsize//size units are points. The default size is Cgsizezero.
decelerating//Returns whether the user lifted their finger after scrolling the view. (Read only)
@property (nonatomic, ReadOnly, getter=isdecelerating) BOOL decelerating//If the user does not drag the content but the scrolling event still occurs, the value returned is yes.
Decelerationrate//A floating-point value that determines the deceleration rate after the user has lifted their finger.
@property (nonatomic) float decelerationrate// The Uiscrollviewdecelerationratenormal and Uiscrollviewdecelerationratefas constants are used as reference points for reasonable deceleration rate.
Delayscontenttouches//A Boolean value that determines whether to postpone the processing of scrolling view touch gestures.
@property (nonatomic) BOOL delayscontenttouches//If the value of this property is yes, the scrolling view delays the handling of the touch gesture until it can determine
Whether scrolling is intended. If the value is no, the scrolling view immediately calls TouchesShouldBegin:withEvent:inContentView: The default value is yes.
Represents the delegate//scroll View object.
@property (nonatomic, assign) ID delegate//The delegate must take a uiscrollviewdelegate protocol. The Uiscrollview class calls the delegate to implement the method of each protocol, and it does not preserve the delegate.
Directionallockenabled//A Boolean value that determines whether scrolling is disabled in a particular direction
@property (nonatomic, getter=isdirectionallockenabled) BOOL directionallockenabled//If this property is no, then scrolling is allowed in both horizontal and vertical directions. If yes, it is only in the direction in which the user starts scrolling (horizontal or vertical) and can scroll in any direction if the start scrolling is diagonally. The default value is No.
dragging//A Boolean value that indicates whether the user has started scrolling content. (Read only)
@property (nonatomic, ReadOnly, getter=isdragging) BOOL dragging/The value of this property may take some time or a scrolling distance before it is set to Yes
Indicatorstyle//scrolling indicator style.
@property (nonatomic) Uiscrollviewindicatorstyle Indicatorstyle//Default style Uiscrollviewindicatorstyledefault. See "Scroll Indicator Style"
Describe these constants
Maximumzoomscale//A floating-point value specifies the largest factor that can be used to scroll the contents of the view.
@property (nonatomic) Float Maximumzoomscale//This value determines how much content can be extended. It must be larger than the minimum zoom scale to enable. The default value is 1.0.
Discussion
Minimumzoomscale floating-point value specifying the lowest scale factor that can be applied to the content of a scrolling view
@property (nonatomic) Float Minimumzoomscale//This value determines how small content can be scaled. The default value is 1.0
Pagingenabled//A Boolean value that determines whether paging scrolling view is enabled.
@property (nonatomic, getter=ispagingenabled) BOOL pagingenabled//If the value of this property is yes, when the user scrolls, the scrolling view stops a multiple of the bounds of the scrolling view. The default value is No.
Basic gesture recognition for pangesturerecognizer//pan gestures. (Read only)
@property (nonatomic, readonly) Uipangesturerecognizer *pangesturerecognizer//Your application accesses this property when it wants to be able to control pan gesture acknowledgments more precisely by scrolling through the view.
Pinchgesturerecognizer//Pinch basic gesture recognition. (Read only)
@property (nonatomic, readonly) Uipinchgesturerecognizer *pinchgesturerecognizer//Your application accesses this property, It wants to be able to control pinch gesture confirmation more precisely by scrolling through the view.
Scrollenabled//A Boolean value that determines whether scrolling is enabled.
@property (nonatomic, getter=isscrollenabled) BOOL scrollenabled//If the value of this property is Yes, scrolling is enabled, and if it is no, scrolling is disabled. The default value is yes. When scrolling is disabled, the scrolling view does not accept touch events and forwards them to the response chain.
Scrollindicatorinsets//Scrolls the distance of the indicator point to the edge of the scrolling view.
@property (nonatomic) uiedgeinsets scrollindicatorinsets//default value is Uiedgeinsetszero
Scrollstotop//A Boolean value that controls whether scrolling to the top of the gesture is valid
@property (nonatomic) BOOL scrollstotop//When this gesture occurs when the scroll view jumps to the top of the content, the default value for this property is yes.
Showshorizontalscrollindicator//A Boolean value that controls whether the horizontal scrolling indicator is visible.
@property (nonatomic) BOOL showshorizontalscrollindicator//The default value is yes. The indicator is visible, while the trace is in progress and fades out after the end.
Showsverticalscrollindicator//A Boolean value that controls whether the vertical scrolling indicator is visible.
@property (nonatomic) BOOL showsverticalscrollindicator////The default value is yes. The indicator is visible, while the trace is in progress and fades out after the end.
Tracking//returns to determine if the user touches the content to trigger scrolling (read only)
@property (nonatomic, ReadOnly, getter=istracking) BOOL tracking//If the user has touched the content view but may not have started dragging it. The value of this property is Yes
Zoombouncing//A Boolean value that indicates that the scaling has exceeded the specified receive range. (Read only)
@property (nonatomic, ReadOnly, getter=iszoombouncing) BOOL zoombouncing//The value of this property is yes if the scrolling view zooms back to the minimum or maximum zoom scale value, otherwise the value is no.
Zooming//A Boolean value that indicates whether the content is thought to be zoomed in or out. (Read only)
@property (nonatomic, ReadOnly, getter=iszooming) BOOL zooming//If the user scales the gesture, otherwise it is not the value of this property is Yes
Zoomscale//A floating-point value that specifies the scale factor that is currently used to scroll the contents of the view.
@property (nonatomic) Float Zoomscale//This value determines how much content is currently being scaled. The default value is 1.0
Cgsize contentsize the size of the scroll range
Uiedgeinsets the position of the Contentinset view in ScrollView
Id<uiscrollerviewdelegate> Delegate Setup Protocol
BOOL directionallockenabled Specifies whether the control can only scroll in one Direction
BOOL bounces control controls whether the border bounces
BOOL alwaysbouncevertical Controls whether a border is bouncing vertically
BOOL Alwaysbouncehorizontal Control Horizontal direction encountered whether the border bounces
BOOL pagingenabled Control whether the control is full page flipping
BOOL scrollenabled Controls whether the control can scroll
BOOL Showshorizontalscrollindicator Controls whether horizontal scroll bars are displayed
BOOL Showsverticalscrollindicator Controls whether to display scroll bars in a vertical direction
Uiedgeinsets scrollindicatorinsets Specifies the position of the scrollbar in Scrollerview
Uiscrollviewindicatorstyle Indicatorstyle Setting the style of the scroll bar
Float decelerationrate Change the scrollerview position of the deceleration point
BOOL Tracking Monitor whether the current target is being traced
BOOL dragging monitor whether the current target is being dragged
BOOL decelerating Monitor whether the current target is slowing down
BOOL Delayscontenttouches Control whether the view is delayed call to start scrolling method
BOOL cancancelcontenttouches Controls whether the control touches an event that cancels the touch
The minimum ratio of float minimumzoomscale reduction
Maximum ratio of float maximumzoomscale magnification
Float Zoomscale Set Change ratio
BOOL Bounceszoom Controls whether the zoom will rebound
BOOL zooming determines whether the size of the control is changing
BOOL zoombouncing Determines whether scaling bounces are in progress
BOOL scrollstotop control controls scroll to top
Here's a summary of some of Uiscrollview's key points:
Starting with your finger touch screen, ScrollView starts a timer if:
1. Within 150ms if your finger does not have any action, the message will be passed to Subview.
2.150ms inside the finger has obvious sliding (a swipe action), ScrollView will scroll, the message will not be passed to Subview, here is the cause of the problem two.
3.150ms the finger does not slide, scrollview the message to Subview, but then the finger starts to slide, ScrollView transmits touchescancelled message to Subview, and then starts scrolling.
Observe the situation of TableView, you first hold down a cell,cell start highlighting, hands do not let go, start sliding, tableview start scrolling, highlight Cancel.
The role of Delayscontenttouches:
This flag by default is yes, using the above 150ms timer, if set to No,touch event immediately passed to Subview, there will be no 150ms waiting.
The role of Cancelstouches:
This standard defaults to Yes, and if set to No, this scroll event will not happen again once the message is passed to Subview.
Instance Methods
Flashscrollindicators//Temporarily display scrolling indicator.
-(void) flashscrollindicators//When you move the scrolling view to the front, you should call this method.
Scrollrecttovisible:animated://Scrolls the contents of a specific area so that it is visible in the receive
-(void) scrollRectToVisible: (cgrect) Rect animated: (BOOL) Animated//This method scrolls through the contents so that the area defined by the RECT is only visible within the scrolling view. If the area is already visible, the method does nothing.
Parameters:
Rect//defines a rectangular area of the content view.
Animated//yes If the scrolling should be animated, NO if it should be immediate.
Setcontentoffset:animated: Sets the origin of the receiver from the original point offset of the content view
-(void) Setcontentoffset: (Cgpoint) Contentoffset animated: (BOOL) animated
Parameters:
Contentoffset//A point offset from the origin point of the content view
Animated yes indicates a transition to a new offset at a constant speed, no means immediate arrival
Setzoomscale:animated://A floating-point number specifies the current zoom ratio
-(void) Setzoomscale: (float) scale animated: (BOOL) animated//new value should be between Minimumzoomscale and Maximumzoomscale
Parameters:
Scale//Zoom the new value of the content.
Animated//yes pushes the transition to a new scale, NO to make an immediate transition.
TouchesShouldBegin:withEvent:inContentView://Customize the default behavior when the finger touches the content that is displayed in the subclass override.
-(BOOL) Touchesshouldbegin: (Nsset *) touches withevent: (Uievent *) event Incontentview: (UIView *) View// The default behavior of Uiscrollview is to invoke the target child view of the Uiresponder event handling method that the touch event occurred
Parameters:
Touches//A involved Uitouch instance set represents the beginning of an event
Event//Represents the object that the touch touch object belongs to.
View//The Touch gestures sub-view occurs in the content.
return Value//returns No if you do not want to scroll the view to send an event message to view. If you want to receive these messages, return Yes (default).
Touchesshouldcancelincontentview://Returns whether to cancel the contact of the content sub-view and start dragging.
-(BOOL) Touchesshouldcancelincontentview: (UIView *) View//It starts sending the content view of the tracking message after the view calls this method. If it receives no from this method, it stops dragging and forwarding the content child view of the touch event. Scrolling view does not call this method if the Cancancelcontenttouches property value is no
Parameters:
View objects that are triggered by the view in the content
Return Value//yes Cancel further touch message viewing, no view continues to receive these messages. Returns no if the view thinks it is not a Uicontrol object by default Yes
Zoomtorect:animated://shrinks content to a specific area, so it is visible in the receiver.
-(void) Zoomtorect: (cgrect) Rect animated: (BOOL) Animated//This method adjusts the Zoomscale to make the necessary scaling so that the content view becomes the area defined by the rectangle
Rect//Rectangle defines the content view area
Animated//yes If the scrolling should be animated, NO if it should be immediate.
Constants
Scroll Indicator Style
typedef enum {//indicator style settings
Uiscrollviewindicatorstyledefault,//default,
Uiscrollviewindicatorstyleblack,//for white content backgrounds
Uiscrollviewindicatorstylewhite
} Uiscrollviewindicatorstyle;
Deceleration Constants//deceleration constant
The rate of deceleration for a scrolling view.
{
const float Uiscrollviewdecelerationratenormal; Default deceleration rate
const float Uiscrollviewdecelerationratefast;
}
Summary of properties of Uiscrollview