private TableViewCell ConfigureCellWithRowAtEnd(TableViewCell cell, int row, bool atEnd) { cell.SetRowNumber(row); cell.transform.SetParent(tableViewScroll.Content, false); float cellSize = cellSizes.SizeForRow(row) - ((row > 0) ? tableViewLayout.Spacing : 0); CreateLayoutIfNeededForCellWithSize(cell, cellSize); cell.DidHighlightEvent.RemoveListener(CellDidHighlight); cell.DidHighlightEvent.AddListener(CellDidHighlight); cell.DidSelectEvent.RemoveListener(CellDidSelect); cell.DidSelectEvent.AddListener(CellDidSelect); visibleCells.SetCellAtIndex(row, cell); if (atEnd) { cell.transform.SetSiblingIndex(tableViewScroll.Content.childCount - 2); } else { cell.transform.SetSiblingIndex(1); } return(cell); }
private TableViewCell CreateCellFromPrefab(string reuseIdentifier, int row) { if (!prefabCells.IsRegisteredCellReuseIdentifier(reuseIdentifier)) { return(null); } GameObject cellPrefab = prefabCells.PrefabForCellReuseIdentifier(reuseIdentifier); TableViewCell cell = Instantiate(cellPrefab).GetComponent <TableViewCell>(); cell.SetRowNumber(row); return(ConfigureCellWithRowAtEnd(cell, row, true)); }