Ios – Table view doesn’t scroll when I use gesture recognizer

iosuigesturerecognizeruitableview

My app has a table view (with a scroll-into of course) and this view slides on and off with a gesture recognizer (like on the Facebook app).

If I use a button to slide [the table view onto the screen], it works fine but when I use a gesture recognizer, the table view can't be scrolled anymore.

Here is the code of gesture recognizer with the problem:

[self.view addGestureRecognizer:self.slidingViewController.panGesture];

Somebody have an idea?

Best Answer

Your gesture is probably preventing the scroll view gesture from working because by default only 1 gesture can be recognising at a time. Try adding yourself as the delegate of your gesture and implementing:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
    return YES;
}

self.slidingViewController.panGesture.delegate = self;

also, add <UIGestureRecognizerDelegate> to the list of protocols you implement