I'm using ECSlidingViewController in my application, it contains owns GestureRecognizer
that looks like:
[self.view addGestureRecognizer:self.slidingViewController.panGesture];
And it's preventing TableView's scrolling. When I deleted that line scroll works fine. What's wrong with my approach?
Note: TableView
is a part of Navigation Controller. And I'm using StoryBoards.
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
).