Table view doesn't scroll when I use gesture recognizer Table view doesn't scroll when I use gesture recognizer ios ios

Table view doesn't scroll when I use gesture recognizer


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


I have used UIPangesture in my UItableview and to avoid this gesture I have used below delegate,

//This method helped me stopped up/down pangesture of UITableviewCell and allow only vertical scrolloverride func gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer) -> Bool {    if let panGestureRecognizer = gestureRecognizer as? UIPanGestureRecognizer {        let translation = panGestureRecognizer.translationInView(superview)        if fabs(translation.x) > fabs(translation.y) {            return true        }        return false    }    return false}


Here is the swift version:

func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool {    return true}