gpt4 book ai didi

ios - 检测用户何时将手指从 UIScrollView 上移开

转载 作者:行者123 更新时间:2023-11-29 10:25:05 25 4
gpt4 key购买 nike

我想检测用户在滚动时何时在 UITableView 中抬起手指,因此在 UIScrollView 委托(delegate)方法 scrollViewDidScroll:

func scrollViewDidScroll(scrollView: UIScrollView)
{
// Some code…


if scrollView.panGestureRecognizer.state == .Ended
{
NSLog("ENDED")
}
}

对我来说这听起来应该可行,所以当我进一步调查并记录此时发生的状态时,仅有的两个日志是ChangedPossible

根据我的理解,如果手势已经结束,Ended 应该在可能之前发生。

苹果文档:

The gesture recognizer has received touches recognized as the end of a continuous gesture. It sends its action message (or messages) at the next cycle of the run loop and resets its state to UIGestureRecognizerStatePossible.

这里到底发生了什么?我如何找到用户在滚动期间将手指从我的 UITableView 上移开的时间?

最佳答案

好的,所以 scrollViewDidEndDragging:willDecelerate: 不会在 ScrollView 未被拖动时触发,实际上是在用户抬起手指时触发。这是触发 Ended 的地方。

关于ios - 检测用户何时将手指从 UIScrollView 上移开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32811818/

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