//项目要求tableView滚动到底部就自动加载下一页,UITableView继承自UIScrollView 所以可以在//scrollViewDidEndDecelerating这个方法中进行判断操作
1 -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ 2 if (scrollView == myScrollView) { 3 CGPoint offset = myScrollView.contentOffset; 4 CGRect bounds = myScrollView.bounds; 5 CGSize size = myScrollView.contentSize; 6 UIEdgeInsets inset = myScrollView.contentInset; 7 float y = offset.y + bounds.size.height - inset.bottom; 8 float h = size.height; 9 10 if((int)y == (int)h ) { //滑动到底部 11 12 //执行加载下一页 13 14 } 15 } 16 }
时间: 2024-11-10 13:57:21