Xamarin iOS,UITableView,滚动加载更多

时间:2014-03-12 08:28:12

标签: uitableview xamarin.ios

请您分享代码片段或指导我访问xamarin文档,如何实现UITableView,滚动以加载更多功能。

如何检测tableview是否已滚动到底部?

提前致谢!

2 个答案:

答案 0 :(得分:4)

TableViewSource类中的

覆盖此方法

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

        if (indexPath.Row == tableItems.Count - 1) {
            //Reload your data here
        }
    }

答案 1 :(得分:2)

构造函数TableViewSource类

isScrolling = false;
TableViewSource类中的

覆盖此方法

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
        }
    }