gpt4 book ai didi

ios - 如何将触摸从 UIScrollView 移动到 UITableViewCell?

转载 作者:行者123 更新时间:2023-11-30 11:15:57 25 4
gpt4 key购买 nike

我有一个 UITableView->UITableViewCells->UIScrollView 层次结构。如果我点击我的单元格,hitTest 会说触摸位于 UIScrollView 中,如果我滚动 - 它也会显示在 UIScrollView 中。如何使触摸位于 UITableViewCell 级别,但滚动位于 UIScrollView 级别?

最佳答案

这应该是一条评论,但不幸的是太长了:

docs说:

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.

那么,您确定将 UIScrollView 作为 subview 添加到表格 View 单元格的 contentView 中,而不是单元格本身吗?

关于ios - 如何将触摸从 UIScrollView 移动到 UITableViewCell?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51750130/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com