2016-11-18 91 views
0

containerViewController | V pageViewController | | V V ViewController1 ViewController2 | V tableView (property of ViewController2) 的UITableView在UIPageViewController不能調用方法didSelectRowAtIndexPath方法

你好,

我有兩個UIViewControllers一個pageViewController。其中一個包含一個tableView。 當我在這個pageViewController中創建了tableView時,didSelectRowAtIndexPath方法從未被觸發。但是,我可以在我的牢房處理「觸摸事件」。

請看下面的代碼:

// Init pageViewController 
self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; 

self.pageController.view.translatesAutoresizingMaskIntoConstraints = false; 

CGRect pageFrame = self.view.bounds; 
pageFrame.origin.y = TOP_BAR_HEIGHT; 
self.pageController.view.frame = pageFrame; 

// Set pageviewControllers with my array of controllers (with ViewController1 and ViewController2) 
[self.pageController setViewControllers:@[self.subViewControllers[0]] 
           direction:UIPageViewControllerNavigationDirectionForward 
           animated:NO 
          completion:nil]; 

[self addChildViewController:self.pageController]; 
[self.view addSubview:self.pageController.view]; 
[self.pageController didMoveToParentViewController:self]; 

但是,這是很奇怪的一件事是:當我拖上我的手指的單元格,我刪除了我的手指,didSelect被解僱的方法,而簡單的觸摸不起作用...

我已經搜索Stackoverflow,我只找到這個topic

他解決他的問題,在一個UIViewController一個嵌入式的tableView,但我已經實現像我的代碼...

編輯:我已經把代碼Github上。 source code

+0

什麼對象是表視圖的委託和數據源? – dlbuckley

+0

委託是ViewController2,這與數據源相同。但它直接沒有問題(它在其他情況下工作得很好) – Geoffrey

+1

你可能實現了didDEselect方法嗎?我曾經那樣做過,並且搜尋了幾個小時。 – ben

回答

0

好的我找到了問題... 容器視圖中有一個UITapGestureRecognizer。這是錯誤。 Thx全部。

相關問題