public SectionSize(TableView tableView, AbstractTableViewDataSource datasource, int section, float offset) { int rowCount = datasource.GetNumberOfRows(tableView, section); rows = new float[rowCount + 1]; rows[0] = offset; if (rowCount > 0) { rows[1] = offset + datasource.GetHeaderHeight(tableView, section); for (int i = 2; i <= rowCount; i++) { rows[i] = rows[i - 1] + datasource.GetRowHeight(tableView, section, i - 1) + datasource.GetRowSpacing(tableView, section); } } HasHeader = datasource.GetHeaderHeight(tableView, section) > 0; Top = rows[0]; if (rowCount == 0) { Bottom = rows[rows.Length - 1] + datasource.GetHeaderHeight(tableView, section) + datasource.GetRowSpacing(tableView, section); } else { Bottom = rows[rows.Length - 1] + datasource.GetRowHeight(tableView, section, rowCount) + datasource.GetRowSpacing(tableView, section); } }
public TableSize(TableView table, AbstractTableViewDataSource datasource) { sections = new SectionSize[datasource.GetNumberOfSections(table)]; float offset = 0; Empty = true; for (int i = 0; i < sections.Length; i++) { var section = new SectionSize(table, datasource, i, offset); sections[i] = section; offset = section.Bottom; Empty = Empty && section.Empty; } }