首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >addTarget to UIRefreshControl()

addTarget to UIRefreshControl()
EN

Stack Overflow用户
提问于 2016-01-05 14:16:14
回答 1查看 451关注 0票数 1

我做了一个UIRefreshControl

代码语言:javascript
复制
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做的那样,但是对于底部

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-01-06 12:20:29

您可以使用内置的scrollViewDidEndDecelerating

代码语言:javascript
复制
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
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34613785

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档