public PageView Init() { if (horizontal) { content.pivot = new Vector2(0, 0.5f); } else if (vertical) { content.pivot = new Vector2(0.5f, 1f); } _totalPage = content.childCount - 1; int i = 0; foreach (RectTransform child in content) { PageItem item = child.GetComponent <PageItem>(); if (null == item) { item = child.gameObject.AddComponent <PageItem>(); } item.index = i; ++i; } if (_pageIndicator) { _pageIndicator.Page = this; _pageIndicator.Build(_totalPage + 1); } _endPos = content.anchoredPosition; return(this); }