/// <summary> /// 根据索引index更新对应的cell的内容 /// </summary> /// <param name="cell"></param> /// <param name="index"></param> private void UpdateCellForIndex(TableViewCell <T> cell, int index) { cell.DataIndex = index;//确定cell的索引 if (cell.DataIndex >= 0 && cell.DataIndex <= tableData.Count - 1) { cell.gameObject.SetActive(true); cell.UpdateContent(tableData[cell.DataIndex]); cell.Height = CellHeightAtIndex(cell.DataIndex); } else { cell.gameObject.SetActive(false); } }
private void UpdateCellForIndex(TableViewCell cell, int index) { cell.DataIndex = index; if (cell.DataIndex >= 0 && cell.DataIndex <= itemCount - 1) { cell.gameObject.SetActive(true); cell.UpdateContent(index); cell.Height = CellHeightAtIndex(cell.DataIndex); } else { cell.gameObject.SetActive(false); } }
// セルの内容を更新するメソッド protected void UpdateCellForIndex(TableViewCell <T> cell, int index) { // セルに対応するリスト項目のインデックスを設定する cell.DataIndex = index; if (cell.DataIndex >= 0 && cell.DataIndex <= tableData.Count - 1) { // セルに対応するリスト項目があれば、セルをアクティブにして内容を更新し、高さを設定する cell.gameObject.SetActive(true); cell.UpdateContent(tableData[cell.DataIndex]); cell.Height = CellHeightAtIndex(cell.DataIndex); } else { // セルに対応するリスト項目がなかったら、セルを非アクティブにして表示しない cell.gameObject.SetActive(false); } }
// 셀의 내용을 갱신하는 메서드 private void UpdateCellForIndex(TableViewCell <T> cell, int index) { // 셀에 대응하는 리스트 항목의 인덱스를 설정한다 cell.DataIndex = index; if (cell.DataIndex >= 0 && cell.DataIndex <= tableData.Count - 1) { // 셀에 대응하는 리스트 항목이 있다면 셀을 활성화해서 내용을 갱신하고 높이를 설정한다 cell.gameObject.SetActive(true); cell.UpdateContent(tableData[cell.DataIndex]); cell.Height = CellHeightAtIndex(cell.DataIndex); } else { // 셀에 대응하는 리스트 항목이 없다면 셀을 비활성화시켜 표시되지 않게 한다 cell.gameObject.SetActive(false); } }