public override UIViewController GetNextViewController(UIPageViewController pageViewController, UIViewController referenceViewController) { var vc = referenceViewController as PointsBaseViewController; var index = vc.PageIndex; //CurrentIndex = vc.PageIndex; if (CurrentIndex == -1) { CurrentIndex = 0; } else { CurrentIndex = vc.PageIndex; } index++; //if (index > (PageCount - 1)) // index = 0; if (SelectedIndex != -1) { CurrentIndex = index = SelectedIndex; } ChangePage?.Invoke(CurrentIndex, null); if (index > (PageCount - 1)) { index = PageCount - 1; return(null); } return(_parentViewController.ViewControllerAtIndex(index)); }
/// <summary> /// 切換頁數 /// </summary> /// <param name="CurrentPage"></param> private void SetCurrentPage(int CurrentPage, bool isNotify = true) { //先隱藏按鍵,等設定完狀態後在顯示,為了防止畫面閃爍用的;// btnArrowFirst.Visible = false; btnArrowLeft.Visible = false; btnArrowRight.Visible = false; btnArrowLast.Visible = false; if (m_TotalPage == 1) { m_CurrentPage = 1; btnArrowFirst.Enabled = false; btnArrowLeft.Enabled = false; btnArrowRight.Enabled = false; btnArrowLast.Enabled = false; } else if (CurrentPage >= m_TotalPage) { //表示切換至最後一頁;// m_CurrentPage = m_TotalPage; //關閉最後一頁及下一頁按鈕;// btnArrowFirst.Enabled = true; btnArrowLeft.Enabled = true; btnArrowRight.Enabled = false; btnArrowLast.Enabled = false; } else if (CurrentPage <= 1) { //表示切換至第一頁;// m_CurrentPage = 1; //關閉第一頁及前一頁按鈕;// btnArrowFirst.Enabled = false; btnArrowLeft.Enabled = false; btnArrowRight.Enabled = true; btnArrowLast.Enabled = true; } else { //表示切換到中間的頁數;// m_CurrentPage = CurrentPage; btnArrowFirst.Enabled = true; btnArrowLeft.Enabled = true; btnArrowRight.Enabled = true; btnArrowLast.Enabled = true; } //切換頁數通知;// if (isNotify == true) { ChangePage?.Invoke(m_CurrentPage); } //顯示現在的頁數;// tbCurrentPage.Text = m_CurrentPage.ToString(); //按鍵設定完狀態後顯示,為了防止畫面閃爍用的;// btnArrowFirst.Visible = true; btnArrowLeft.Visible = true; btnArrowRight.Visible = true; btnArrowLast.Visible = true; }