Problem detecting if UITableView has scrolled to the bottom

后端 未结 3 772
遇见更好的自我
遇见更好的自我 2021-02-14 23:40

I\'m using the following code to detect if I\'ve reached the bottom of a UITableView

- (void)scrollViewDidScroll:(UIScrollView *)scrollView{ 
    if(self.tableVi         


        
3条回答
  •  耶瑟儿~
    2021-02-15 00:17

    try this way

        if(self.tableview.contentOffset.y<0){
                  //it means table view is pulled down like refresh
                  return;
                }
    else if(self.tableView.contentOffset.y >= (self.tableView.contentSize.height - self.tableView.bounds.size.height)) {
            NSLog(@"bottom!");
            NSLog(@"%@", [self getLastMessageID]);
            [self getMoreStuff:[self getLastMessageID]];
        }
    

提交回复
热议问题