/// <summary> /// 用该manager时都需要初始化 /// </summary> /// <param name="baseCell">需要创建的cell的obj</param> public void Init(BaseCell baseCell) { originCellObj = baseCell; cellHeight += originCellObj.GetCellHeight() + spacing.y; cellWidth += originCellObj.GetCellWidth() + spacing.x; Vector3[] corners = new Vector3[4]; scrollRect.transform.GetComponent <RectTransform>().GetLocalCorners(corners); viewHeight = corners[1].y + cellHeight; startPos = new Vector3(cellWidth / 2, -cellHeight / 2); if (cellHeight == 0 || cellWidth == 0) { Debug.LogError("cell宽或高不能为0"); } }