Search code examples
iosuitableviewxcode6didselectrowatindexpathchildviewcontroller

UITableViewController as ChildViewController not calling delegate methods


I have a UITableViewController , when I use it as 'initial view controller' ,it works perfect. Now, I am using it as a 'child view controller ' of another View controller, but now when I try to select a row , 'didSelectRow' method is not called while when I long tap on the same row, the 'didSelectRow' method gets called. I had gone through almost every question on UITableviewController on SO but till now I haven't found any solution to this problem.

I am using XCode 6 and following code is used to add it as the child View Controller

[self addChildViewController:vc];
[self.ringtoneView addSubview:vc.view];
[vc didMoveToParentViewController:self];

Any help would be greatly appreciated.


Solution

  • Finally I managed to solve the problem, thanks to this answer https://stackoverflow.com/a/18159463/3632958

    I added a tap gesture recogniser by mistake in the Parent view controller which was preventing the normal selections on table view.