You need to add the UIGestureRecognizer
to the view of the UINavigationController
, not the the UITableView
.
One way to do this is to create a UINavigationController
subclass that handles the creation of both the gesture recognizer and the instantiation of your underLeft (or underRight) view controller for the ECSlidingViewController:
// MyNavigationController.h
@interface MyNavigationController : UINavigationController
@end
// MyNavigationController.m
@implementation MyNavigationController
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
if (![self.slidingViewController.underLeftViewController isKindOfClass:[MyLeftMenuViewController class]]) {
self.slidingViewController.underLeftViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MenuViewController"];
}
[self.view addGestureRecognizer:self.slidingViewController.panGesture];
}
@end
Open the Storyboard Editor, select the navigation controller and set the Identity Inspector's Custom Class field to MyNavigationController
(rather than the default UINavigationController
).