Skip to content
This repository has been archived by the owner on Sep 11, 2022. It is now read-only.

How To: Help! The PKRevealController interferes with my UITableView cell swipes

pkluz edited this page Jan 31, 2013 · 3 revisions

As of the time of this writing there is no known way (to me at least) to fix this on my end of the controller to properly work under all conditions imaginable. I.e. you need to handle said case yourself. Therefore, the controller exposes the revealPanGestureRecognizer property to you.

Simply, when instantiating the controller pass this option in your options dictionary:

    NSDictionary *options = @{
        PKRevealControllerRecognizesPanningOnFrontViewKey : @NO
    };

This will disable pan-based reveal for the entire front view. Now, you can use the revealPanGestureRecognizer and add it to any view you desire to be panned on that doesn't interfere with your table view, to enable gesture based reveal.

I'd advise (if working with a table based environment with swipe'able cells) you, to add the revealPanGestureRecognizer to your front view controller's navigation bar (which it most likely has):

    [self.navigationController.navigationBar addGestureRecognizer:self.revealController.revealPanGestureRecognizer];

And voilà - panning doesn't interfere with your table view anymore.

(For more information on this, as well as some rationale see https://github.com/pkluz/PKRevealController/issues/76 )

--

Note: There's another way to handle this using the UIGestureRecognizerDelegate protocol method:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer

...Though it can get kind of messy seeing how the UITableView has about five gesture recognizers and it handles the cell's edit modes globally...

Clone this wiki locally