How can I determine if the user has scrolled to the last cell/bottom of a UITableView?
Thanks to newer iOS versions, there's an easy way with the willDisplayCell function:
func tableView(tableView:UITableView, willDisplayCell cell:UITableViewCell, forRowAtIndexPath indexPath:NSIndexPath) {
if (indexPath.row >= tableView.numberOfRowsInSection(0)) {
NSLog("User got to bottom of table")
}
}
Note that UICollectionViews have a similar function:
func collectionView(collectionView: UICollectionView, willDisplayCell cell: UICollectionViewCell, forItemAtIndexPath indexPath: NSIndexPath) {
}