我想檢測用戶是否滾動到UITableView的底部,以便我可以做一些額外的東西。爲了正確計算事情,我需要獲取UITableView的可見矩形。我怎樣才能做到這一點?如何獲得UITableView的可見矩形?
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
[_refreshHeaderView egoRefreshScrollViewDidScroll:scrollView];
int currentMaxPosition = CGRectGetMaxY([self.tableView visibleRect]);
int currentMinPosition = CGRectGetMinY([self.tableView visibleRect]);
int tableViewBottom = [self.tableView bounds].size.height - 100;
int tableViewTop = 0;
//get older messages once we're near the bottom
if (currentMaxPosition > tableViewBottom - 100)
{
NSLog(@"WE AT THE BOTTOM!");
}
}
基於visiblecell我如何確定用戶是否在底部? –
使用' - (NSArray *)indexPathsForVisibleRows'獲取這些行的索引路徑 – 2011-07-21 14:58:56