Created
March 13, 2015 03:19
-
-
Save kentcb/aafc739ec1958af75289 to your computer and use it in GitHub Desktop.
iOS bug wrt UITableViewSource that overrides EstimatedHeight
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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