我做了一个UIRefreshControl
refresher = UIRefreshControl()
refresher.attributedTitle = NSAttributedString(string: "refresh")
refresher.addTarget(self, action: "refreshed", forControlEvents: UIControlEvents.ValueChanged)
refresher.addTarget(self, action: "refreshed", forControlEvents: UIControlEvents.ApplicationReserved)
refresher.addTarget(self, action: "refreshed", forControlEvents: UIControlEvents."scrolled down to bottom") 它是一个刷新器,工作正常,但是我想添加一个操作,当我向下滚动到我的tableView底部时,它会刷新,就像我对ValueChanged做的那样,但是对于底部
发布于 2016-01-06 12:20:29
您可以使用内置的scrollViewDidEndDecelerating
func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
let bottomEdge = scrollView.contentOffset.y + scrollView.frame.size.height
if bottomEdge >= scrollView.contentSize.height {
// Reached bottom, do your refresh
print("Bottom")
}
}当scrollView已经结束,它是减速,你在底部,然后你可以调用你的refresher。
https://stackoverflow.com/questions/34613785
复制相似问题