I’m reading the following about UIScrollView from Apple UIScrollView Class Reference Documentation:
Because a scroll view has no scroll
bars, it must know whether a touch
signals an intent to scroll versus an
intent to track a subview in the
content. To make this determination,
it temporarily intercepts a touch-down
event by starting a timer and, before
the timer fires, seeing if the
touching finger makes any movement. If
the timer fires without a significant
change in position, the scroll view
sends tracking events to the touched
subview of the content view. If the
user then drags their finger far
enough before the timer elapses, the
scroll view cancels any tracking in
the subview and performs the scrolling
itself. Subclasses can override the
touchesShouldBegin:withEvent:inContentView:,
pagingEnabled, and
touchesShouldCancelInContentView:
methods (which are called by the
scroll view) to affect how the scroll
view handles scrolling gestures.
I don’t understand the sentence starting with “If the user then drags their finger far enough before the timer elapses…” I thought the timer already fired according to the previous sentence. Is it talking about another timer in this one?
It’s confusing. I believe there are 2 possible behaviors depending on whether your scrollView has the
delaysContentTouchesproperty set (and or thecanCancelContentTouchesproperty is set)If
delaysContentTouchesis set:When the user taps the scroll view it temporarily intercepts a touch-down event by starting a timer and, before the timer fires, seeing if the touching finger makes any movement. If the timer fires without a significant change in position, the scroll view sends tracking events to the touched subview of the content view. If the user drags their finger far enough before the timer elapses, the scroll view begins scrolling.
If the timer has fired:
If
canCancelContentTouchesis set the scroll view cancels and touches passed to its subviews and begins scrolling. Otherwise, no scrolling.If timer has not expired before the user drags his/her finger, scrolling happens.
I think I got that right… (someone might want to double-check)
HTH