Xamarin iOS, UITableView, Scroll to load more

后端 未结 2 1871
孤城傲影
孤城傲影 2021-01-14 01:56

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

相关标签:
2条回答
  • 2021-01-14 02:30

    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
            }
        }
    
    0 讨论(0)
  • 2021-01-14 02:39

    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
            }
        }
    
    0 讨论(0)
提交回复
热议问题