addTarget到

问题描述:

我已经UIRefreshControl()一UIRefreshControladdTarget到

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完成,但对于底部

+0

您需要在表视图上使用滚动视图委托方法来创建自己的表。 'UIRefreshControl'不知道你的表格视图何时到达底部。也许在'scrollViewDidScroll(_ :)'中检查'contentOffset'是否指示表视图已经滚动到底部。 – keithbhunter

+0

@邵浩林:请不要在帖子中添加“谢谢”的地方进行修改。这是[应该编辑出来的绒毛](http://meta.*.com/a/260778/2675154)。 – honk

+0

是的,谢谢,回答这个,以及我的许多其他问题:) – trw

您可以使用内置的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

+1

它与覆盖func – trw