- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
/*
// 判断是否需要加载更多
// 判断等于0可以防止没有数据就显示加载更多控件
// 判断底部视图是否隐藏可以防止重复加载
if (self.statuses.count == 0 ||
self.tableView.tableFooterView.hidden == NO) {
return;
}
// 如果当前的偏移位等于 contentSize.height + contentInset.bottom - scrollView.height; 那么就需要加载更多数据
// 如果当前的偏移位等于 scrollView能够滚动的高度 + 底部额外的扩展区域 - scrollView的高度, 那么就需要加载更多数据
CGFloat offsetY = scrollView.contentSize.height + scrollView.contentInset.bottom - scrollView.height;
if (scrollView.contentOffset.y >= offsetY) {
self.tableView.tableFooterView.hidden = NO;
DDLogDebug(@"加载更多数据");
[self loadMoreStatuses];
}
*/
CGFloat offsetY = scrollView.contentSize.height + scrollView.contentInset.bottom - scrollView.height;
if (scrollView.contentOffset.y >= offsetY)
{
self.tableView.tableFooterView.hidden = NO;
NSLog(@"加载更多");
}
}