0

我使用UINavigationControllerUIPageViewController(第一個pvc)作爲根控制器。 在這個pvc實例中,我有多個視圖,我可以滾動瀏覽。這一切工作正常。多個UIPageViewController的

然後我選擇從其中一個視圖推入,我深入到第二個pvc的層次。當我用第二個pvc滾動並且達到序列的末尾時,我會自動繼續滾動第一個UIPageViewController

我的問題是如何禁用該手勢,並鎖定在第二個pvc滾動的那一刻該第一個pvc的滾動?

這裏是導航控制器堆棧

/////--UINavigationController 

/////----------UIPageViewController (first instance of pvc) 

/////---------------UITableViewController [ TV01 ] push here to second pvc 

/////---------------UITableViewController [ TV02 ] 

/////---------------UITableViewController [ TV03 ] 

/////---------------------UIPageViewController (second instance of pvc) 

/////---------------------------UIViewController 

/////---------------------------UIViewController 

/////---------------------------UIViewController (is scrolling to TV02) 
+1

[email protected]以土耳其語發送郵件給我。 :) – 2014-12-03 08:24:19

回答

0

我有我的問題的解決方案,我想在這裏發表我的答案。主UIPageViewController使用一些UIScrollView對象來處理滾動(至少對於transitionStyle UIPageViewControllerTransitionStyleScroll)。在我推送新的UIPageViewController之前,我已經禁用了此UIPageViewController的滾動選項。所以你總是有一個UIPageViewController激活刷卡。

你可以迭代控制器的子視圖(pageViewController.view.subviews)來獲取它。

-(void)setScrollEnabled:(BOOL)enabled forPageViewController:(UIPageViewController*)pageViewController{ 
    for(UIView* view in pageViewController.view.subviews){ 
     if([view isKindOfClass:[UIScrollView class]]){ 
      UIScrollView* scrollView=(UIScrollView*)view; 
      [scrollView setScrollEnabled:enabled]; 
      return; 
     } 
    } 
} 
相關問題