首页 > 代码库 > uitableView 滚到底部判断

uitableView 滚到底部判断

- (void) scrollViewDidScroll:(UIScrollView *)scrollView{ CGPoint offset = scrollView.contentOffset; // 当前滚动位移 CGRect bounds = scrollView.bounds; // UIScrollView 可视高度 CGSize size = scrollView.contentSize; // 滚动区域 UIEdgeInsets inset = scrollView.contentInset; float y = offset.y + bounds.size.height - inset.bottom; float h = size.height; NSLog(@"offset: %f", offset.y); NSLog(@"content.height: %f", size.height); NSLog(@"bounds.height: %f", bounds.size.height); NSLog(@"inset.top: %f", inset.top); NSLog(@"inset.bottom: %f", inset.bottom); NSLog(@"pos: %f of %f", y, h); float reload_distance = 10; if (y > (h + reload_distance)) { // 滚动到底部 // ... }}http://laiguowei2004.blog.163.com/blog/static/3682900020128252478488/