I am trying to detect when the user gets to the bottom of the table in Xamarin.iOS
. I have created this pseudocode in order to detect the bottom, however as soon as the application runs it prints that it is already at the bottom of the table when in fact it is not..
float height = tableView.Frame.Size.Height;
float contentYoffset = tableView.ContentOffset.Y;
float distanceFromBottom = tableView.ContentSize.Height - contentYoffset;
if (distanceFromBottom < height) {
Console.WriteLine ("Bottom of Table");
}
Any suggestions to improve this code or any better methods of detecting the bottom?
Here is my TableView.cs Class:
public class TableView : UITableView, ITableCellProvider<Datum>
{
public TableView ()
{
}
public TableView (IntPtr handle) : base(handle)
{
}
public UITableViewCell GetCell (Datum item)
{
var newCell = this.DequeueReusableCell(InstagramCell.Key)
as InstagramCell ?? InstagramCell.Create();
newCell.Bind (item);
return newCell;
}
public float GetHeightForRow (NSIndexPath indexPath)
{
return 340f;
}
}