如何在tableview中检测scrollToRow函数的结束?我试图实现scrollViewDidEndScrollingAnimation函数,但是当scrollToRow结束时它不会被调用。
答案 0 :(得分:0)
您应该将代理添加到Scrollview:
override func viewDidLoad()
{
super.viewDidLoad()
self.scrollview.delegate = self
}
答案 1 :(得分:0)
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let height = scrollView.frame.size.height
let contentYoffset = scrollView.contentOffset.y
let distanceFromBottom = scrollView.contentSize.height - contentYoffset
if distanceFromBottom < height {
print(" you reached end of the table")
}
}