如何检查UITableView何时完成滚动 [英] how to check when UITableView is done scrolling

查看:169
本文介绍了如何检查UITableView何时完成滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法检查我的tableview刚完成滚动? table.isDragging table.isDecelerating 是我能找到的唯一两种方法。当tableview完成滚动时,我不确定如何预测或得到通知。

Is there a way to check if my tableview just finished scrolling? table.isDragging and table.isDecelerating are the only two methods that I can find. I am not sure how I can either anticipate or get notified when the tableview finishes scrolling.

如果tableView正在滚动,我可以以某种方式使用计时器来检查每一秒吗?

Can I somehow use timers to check every second if the tableView is scrolling or not?

推荐答案

您可以按如下方式实现 UIScrollViewDelegate 协议方法:

You would implement UIScrollViewDelegate protocol method as follows:

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
    if (!decelerate) {
        [self scrollingFinish];
    }
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    [self scrollingFinish];
}
- (void)scrollingFinish {
    //enter code here
}

对于上面的委托方法滚动视图在拖动内容后用户的手指触摸时发送此消息。 UIScrollView的减速属性控制减速。当视图减速停止时,参数减速

For the above delegate method The scroll view sends this message when the user’s finger touches up after dragging content. The decelerating property of UIScrollView controls deceleration. When the view decelerated to stop, the parameter decelerate will be NO.

第二个用于缓慢滚动,甚至在手指触摸时滚动停止,如Apple Documents所述,滚动时运动停止

Second one used for scrolling slowly, even scrolling stop when your finger touch up, as Apple Documents said, when the scrolling movement comes to a halt.

这篇关于如何检查UITableView何时完成滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆