Http://blog.sina.com.cn/s/blog_45e2b66c01019wfg.html
Uiscrollview fast sliding process, the scrolling speed is too fast, can be controlled by the property decelerationrate.
Decelerationrate Range is 0-----1, General 0---0.5 is not much different. 0 also no problem.
| Decelerationrate set when it slows down the speed, 0.1f words, quickly stop, 1 on the normal speed stop, that is, sliding a certain distance to stop. |
The following subordinate Uiscrollview properties: Turn from http://blog.csdn.net/aaajj/article/details/6872038 in the process of scrolling, in fact, is to modify the origin coordinates
When the finger is touched, scroll view temporarily intercepts the touch event, using a timer that, if no finger move event occurs after the timer point, then scroll view sends tracking events to the clicked Subview
If a move event occurs before the timer point, then scroll view cancels tracking itself to scroll
Subclasses can overload TouchesShouldBegin:withEvent:inContentView: decide if you want to receive touch events
Pagingenabled is yes, automatically scrolls to the boundary of Subview, the default is no
Touchesshouldcancelincontentview: Start sending tracking messages message to Subview
Call this method, decide whether to send tracking messages message to Subview, if return no, send, yes does not send
If the Cancancelcontenttouches property is no, then this method is not called
To affect how scrolling gestures are handled
Scroll view also handles zoom and pan gestures
To achieve zoom and pan, the delegate Viewforzoominginscrollview must be implemented:
ScrollViewDidEndZooming:withView:atScale:
Two methods, in addition Maximumzoomscale and minimumzoomscale two properties otherwise
Several properties
Tracking when touch has not been dragged, the value is yes, otherwise no
Zoombouncing when the content is enlarged to the maximum or minimum, the value is yes, otherwise no
Zooming when scaling, the value is yes, otherwise no
decelerating when scrolling, the fingers release, but still continue to scroll, this time is yes, the other is no
Decelerationrate setting the deceleration rate after the finger release
Maximumzoomscale a floating-point number that indicates the maximum number of times that can be put
Minimumzoomscale a floating-point number that represents the smallest possible multiplier
Pagingenabled is yes, automatically scrolls to the boundary of Subview, the default is no
Scrollenabled decide if you can scroll
Delayscontenttouches
is a Boolean, when the value is yes, the user touches the beginning, scroll view to delay a moment, to see if the user has the intention to scroll, if scrolling, then capture the Touch-down event, otherwise will not capture, if the value is no, when the user touches, scroll View will immediately trigger TouchesShouldBegin:withEvent:inContentView:, default is Yes
Cancancelcontenttouches The value is yes when the user touches and then does not move within a certain amount of time, ScrollView sends tracking events, and then the user moves the finger enough to trigger the scrolling event, this time, ScrollView sent Touchescancelled:withevent: to Subview, then scroview start scrolling If the value is No,scrollview send tracking events, even if the user moves the finger, ScrollView also does not scroll the size of the content inside the contentsize, that is, the size can be scrolled, the default is 0, no scrolling effect. Showshorizontalscrollindicator scrolling, whether the horizontal scroll bar is displayed showsverticalscrollindicator scrolling, whether the vertical scrollbar is displayed bounces by default Yes, or scrolling over the boundary, Rebound has rebound effect, if it is no, then scroll to reach the boundary, then will stop bounceszoom and bounces similar, the difference is that the effect reflected in the scale above, if the scale exceeds the maximum scale, then will rebound effect, if no, then reach the maximum or the smallest time , stop immediately directionallockenabled default is no, can be in both vertical and horizontal direction of movement, the value is yes, if the beginning is vertical or horizontal movement, then the next lock will be locked in another direction of the scroll, if the beginning is the diagonal direction of scrolling, Does not prohibit a direction indicatorstyle the style of the scroll bar, basically just set the color, a total of 3 colors, default, black, white scrollindicatorinsets set the position of the scroll bar http://blog.csdn.net/ diyagoanyhacker/article/details/6062498/*******************************/
Summary of properties of Uiscrollview
| Property |
Role |
| Cgpoint Contentoffset-------------------------- |
Monitor the current scrolling position |
| Cgsize contentsize------------------------------ |
The size of the scrolling range |
| Uiedgeinsets Contentinset--------------------- |
The position of the view in ScrollView |
| Id<uiscrollerviewdelegate> delegate------ |
Set up protocols |
| BOOL directionallockenabled---------------- |
Specifies whether the control can scroll only in one Direction |
| BOOL bounces------------------------------------ |
Controls whether the control encounters a border bounce |
| BOOL alwaysbouncevertical------------------ |
Controls whether the bounding rectangle is bouncing in the vertical direction |
| BOOL Alwaysbouncehorizontal-------------- |
Controls whether the bounding rectangle bounces when the horizontal direction is encountered |
| BOOL pagingenabled--------------------------- |
Controls whether the control is full-page flipping |
| BOOL scrollenabled----------------------------- |
Controls whether controls can scroll |
| BOOL showshorizontalscrollindicator------ |
Controls whether to display scroll bars in the horizontal direction |
| BOOL Showsverticalscrollindicator---------- |
Controls whether to display scroll bars in a vertical direction |
| Uiedgeinsets scrollindicatorinsets----------- |
Specify the position of the scrollbar in Scrollerview |
| Uiscrollviewindicatorstyle indicatorstyle- |
Set the style of the scroll bar |
| Float Decelerationrate--------------------------- |
Change the position of the deceleration point of the Scrollerview |
| BOOL Tracking------------------------------------- |
Monitor whether the current target is being tracked |
| BOOL dragging------------------------------------ |
Monitor whether the current target is being dragged |
| BOOL decelerating------------------------------- |
Monitor whether the current target is slowing down |
| BOOL delayscontenttouches----------------- |
Controls whether the view is delayed call to start scrolling method |
| BOOL cancancelcontenttouches------------ |
Controls whether the control touches an event that cancels the touch |
| Float Minimumzoomscale----------------------- |
Minimum scale to shrink |
| Float Maximumzoomscale---------------------- |
Maximum scale of magnification |
| Float Zoomscale----------------------------------- |
Set the change ratio |
| BOOL Bounceszoom---------------------------- |
Controls whether the zoom will bounce |
| BOOL zooming------------------------------------ |
Determine if the size of the control is changing |
| BOOL zoombouncing--------------------------- |
Determine if scale bounce is 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.
Uiscrollviewdelegate protocol
The method is called when the ScrollView is scrolled. This method is called by any change in the value of offset. That is, during scrolling, multiple calls are made
-(void) Scrollviewdidscroll: (Uiscrollview *) scrollview{
From there, you can read the Contentoffset property to determine where it is scrolled to.
Note: When the Contentsize property is smaller than the frame, scrolling will not be started
}
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{}
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, and the method
-(void) scrollviewwillenddragging: (Uiscrollview *) ScrollView withvelocity: (cgpoint) Velocity targetcontentoffset: ( InOut cgpoint *) targetcontentoffset{}
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{}
This method is called when the slide slows down.
-(void) scrollviewwillbegindecelerating: (Uiscrollview *) scrollview{}
The method is called when the scrolling view slows down and the scroll stops. A valid slide, executed only once.
-(void) scrollviewdidenddecelerating: (Uiscrollview *) scrollview{}
When the scrolling view animation is complete, the method is called, and if there is no animation, the method will not be called
-(void) Scrollviewdidendscrollinganimation: (Uiscrollview *) scrollview{}
Returns the UIView object that will be scaled. To perform multiple
-(UIView *) Viewforzoominginscrollview: (Uiscrollview *) scrollview{}
This method is called when the ScrollView is scaled. Calls back multiple times during the scaling process
-(void) Scrollviewdidzoom: (Uiscrollview *) scrollview{}
The method is executed when the scaling is about to begin. Once a valid scaling is performed.
-(void) scrollviewwillbeginzooming: (Uiscrollview *) ScrollView Withview: (UIView *) view{}
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{}
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{}
When the scrolling view is scrolled to the top, the method is executed
-(void) Scrollviewdidscrolltotop: (Uiscrollview *) scrollview{
}
This article is from the "the Templar's iOS" blog, so be sure to keep this source http://10646127.blog.51cto.com/10636127/1690221
Reprint--ios,uiscrollview Related Properties, method