John-Lluch / SWRevealViewController

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !
Other
4.52k stars 989 forks source link

Pangesture fails if RevealViewController is inside a UINavigationController while using RightView #149

Closed guidedways closed 10 years ago

guidedways commented 10 years ago

Here's my setup:

Root RevealViewController has 'Front' as a UINavigationController and a 'Right' as a normal UIViewController.

The Front UINavigationController then has a 'RevealViewController' with a 'Rear' and a 'Front' UIViewController.

Even if I add the PanGesture of the Root RevealViewController and the one inside the UINavigationController to the 'Front' view, the 'Right' view never gets displayed given pan only slides the views in the second revealview (inside the UINavigationController). Desired effect is to allow the second pan gesture of the root RevealView to take over when user swipes left (given there's no right view in the child revealview). I've overcome this by adding this line to the front view:

[self.revealViewController.revealViewController.panGestureRecognizer requireGestureRecognizerToFail:self.revealViewController.panGestureRecognizer];

And then calling the following in handleRevealGestureStateChanged when checking for a nil right view:

  [recognizer setState: UIGestureRecognizerStateFailed];

But then once you pan left, you cannot pan right as that gets intercepted again by the child revealview. I could add another pan gesture on top of that but that's an ugly solution. So far this looks like a limitation.

John-Lluch commented 10 years ago

It will not work because you are attaching the pan gesture recognizers to the same view or to views that are overlaping, one of the two will always win and it may not be the one that you want at any given time.

Why can't you use a single SWRevealViewController with both rear and right controllers?