Skip to content

Instantly share code, notes, and snippets.

@milomai
Created August 4, 2018 07:50
Show Gist options
  • Select an option

  • Save milomai/8dfe22e948eb946e4ff0a75e3eca38e5 to your computer and use it in GitHub Desktop.

Select an option

Save milomai/8dfe22e948eb946e4ff0a75e3eca38e5 to your computer and use it in GitHub Desktop.
UIScrollView 下拉刷新和上拉加载更多
- (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