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/
相關文章
相關標籤/搜索