private void InitTemplate()
 {
     for (int i = 0; i < m_CacheCount; i++)
     {
         ItemModelView itemModelView = InstantiateItem(i);
         itemModelView.SetContext(i, Collection.GetBaseItem(i));
     }
 }
        /// <summary>
        /// 更新Item的位置
        /// </summary>
        /// <param name="itemModelView">ItemModelView</param>
        /// <returns>当水平滑动时,左边界返回1,右边界返回-1,未更新返回0,当垂直滑动时,上边界返回-1,下边界返回1,未更新返回0</returns>
        private int UpdatePosition(ItemModelView itemModelView)
        {
            Transform itemTrans = itemModelView.transform;
            float     viewPos   = m_Content.InverseTransformPoint(m_Viewport.position)[(int)m_Axis];
            float     itemPos   = m_Content.InverseTransformPoint(itemTrans.position)[(int)m_Axis];
            float     distance  = itemPos - viewPos;

            if (distance > m_Extents || distance < -m_Extents)
            {
                int sign = distance > m_Extents ? -1 : 1;

                float moveExtents = m_Extents - m_ItemSize[(int)m_Axis] * 0.5f;

                int index = itemModelView.Index;

                ItemContext itemContext = null;

                if (m_Axis == RectTransform.Axis.Horizontal)
                {
                    index += sign * m_CacheCount;
                }
                else
                {
                    index -= sign * m_CacheCount;
                }

                itemContext = Collection.GetBaseItem(index);

                if (itemContext == null)
                {
                    return(0);
                }

                float value = moveExtents * 2 + m_Spacing;
                itemTrans.localPosition += sign * GetAxisVector3(value);

                itemModelView.ClearAllCache();
                itemModelView.SetContext(index, itemContext);
                //Log.Debug("{0} : {1}", m_Axis, sign);
                return(sign);
            }

            return(0);
        }