2016-11-18 108 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全部。

相关问题