how to check when UITableView is done scrolling

后端 未结 4 1804
天涯浪人
天涯浪人 2020-12-17 09:37

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

4条回答
  •  萌比男神i
    2020-12-17 10:38

    After using shanegao's answer and Jovan Stankovic's comment on it, I devised this for Swift3 -

    extension NMViewController: UIScrollViewDelegate {
        func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
            if !decelerate {
                scrollViewDidEndDecelerating(scrollView)
            }
        }
    
        func scrollViewDidScrollToTop(_ scrollView: UIScrollView) {
            scrollViewDidEndDecelerating(scrollView)
        }
    
        func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
            // Your logic to handle after scrolling is done
        }
    }
    

提交回复
热议问题