UIScrollView 的 delaysContentTouches

时间:2021-07-14 01:35:11

UIScrollView 的一段说明:

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.

delaysContentTouches 的说明:

If the value of this property is YES, the scroll view delays handling the touch-down gesture until it can determine if scrolling is the intent. If the value is NO , the scroll view immediately calls touchesShouldBegin:withEvent:inContentView:. The default value is YES.

这个属性有什么具体影响呢,我遇到的就是,在UICollectionView 中,Button的点击响应的不及时,这个参数就能解决这个问题。