How can I detect when a UITableView
has been scrolled to the bottom so that the last cell is visible?
Inside tableView:cellForRowAtIndexPath:
or tableView:willDisplayCell:forRowAtIndexPath:
like this:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
...
NSInteger sectionsAmount = [tableView numberOfSections];
NSInteger rowsAmount = [tableView numberOfRowsInSection:[indexPath section]];
if ([indexPath section] == sectionsAmount - 1 && [indexPath row] == rowsAmount - 1) {
// This is the last cell in the table
}
...
}