public void Init(GameObject cell, NumOfCellDelegate NumOfCell, PixelCellDelegate PixelCell, int padding = 5, int fristPadding = 5, int lastPadding = 5) { if (cell == null) { return; } this.cell = cell; RectTransform rectTs = this.transform as RectTransform; UITableView tableView = GetComponent <UITableView>(); region = rectTs.rect; this.NumOfCell = NumOfCell; this.PixelCell = PixelCell; RectTransform contentRt = content.transform as RectTransform; contentRt.pivot = new Vector2(0, 1); contentRt.anchorMin = new Vector2(0, 1); contentRt.anchorMax = new Vector2(0, 1); RectTransform viewportRt = viewport.transform as RectTransform; contentRt.sizeDelta = new Vector2(viewportRt.rect.width, viewportRt.rect.height); contentRt.localPosition = new Vector3(0, 0, 0); if (unusedCells == null) { unusedCells = new BetterList <GameObject>(); } cell.SetActive(false); this.fristPadding = fristPadding; this.lastPadding = lastPadding; InitCellList(); inited = true; }
//只能够覆盖 public void SetNumOfCell(NumOfCellDelegate NumOfCell) { this.NumOfCell = NumOfCell; }