Created
August 4, 2018 07:50
-
-
Save milomai/8dfe22e948eb946e4ff0a75e3eca38e5 to your computer and use it in GitHub Desktop.
UIScrollView 下拉刷新和上拉加载更多
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView { | |
| // contentSize 高度小于 scrollView 控件的高度,说明内容不足一页,不需要加载更多 | |
| CGFloat offset = scrollView.contentSize.height-scrollView.height; | |
| if (offset > 0 && scrollView.contentOffset.y > offset) { | |
| // 加载更多 | |
| } | |
| if (scrollView.contentOffset.y < 0) { | |
| // 刷新 | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment