Skip to content

Instantly share code, notes, and snippets.

@kentcb
Created March 13, 2015 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kentcb/aafc739ec1958af75289 to your computer and use it in GitHub Desktop.
Save kentcb/aafc739ec1958af75289 to your computer and use it in GitHub Desktop.
iOS bug wrt UITableViewSource that overrides EstimatedHeight
public class Source : UITableViewSource
{
public Source(UITableView tableView)
{
// because of a call to ReloadData here...
tableView.ReloadData();
}
// ...this won't be called...
public override nint NumberOfSections(UITableView tableView)
{
return 0;
}
// ...but this will be (even though we want to have 0 sections)...
public override nfloat GetHeightForHeader(UITableView tableView, nint section)
{
throw new NotImplementedException();
}
// ...but commenting out this overload fixes the problem, even though this overload is also not called!
public override nfloat EstimatedHeight(UITableView tableView, NSIndexPath indexPath)
{
return base.EstimatedHeight(tableView, indexPath);
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
throw new NotImplementedException();
}
public override nint RowsInSection(UITableView tableview, nint section)
{
throw new NotImplementedException();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment