4

Can you please share code snippets or direct me to the xamarin docs, how to implement UITableView, scroll to load more functionality.

How to detect if the tableview has scrolled to the bottom?

Thanks in advance!

coder284
  • 831
  • 1
  • 13
  • 34

2 Answers2

4

inside the TableViewSource class override this method

public override void WillDisplay (UITableView tableView, UITableViewCell cell, NSIndexPath     indexPath)
    {

        if (indexPath.Row == tableItems.Count - 1) {
            //Reload your data here
        }
    }
gabriel_0210
  • 70
  • 1
  • 8
2

constructor TableViewSource class

isScrolling = false;

inside the TableViewSource class override this method

public override void Scrolled (UIScrollView scrollView)
    {
        // load more bottom
        float height = scrollView.Frame.Size.Height;
        float distanceFromBottom = scrollView.ContentSize.Height - scrollView.ContentOffset.Y;
        if(distanceFromBottom < height && isScrolling == false) 
        {
            // reload data here
        }
    }