erichoracek / MSDynamicsDrawerViewController

Container view controller that leverages UIKit Dynamics to provide a realistic drawer navigation paradigm.
MIT License
3.2k stars 396 forks source link

PanGesture not (always) recognized by UIView Subclass. #69

Closed MichMich closed 10 years ago

MichMich commented 10 years ago

My Pane viewController has a UIView subclass with the following code in the init function:

[self addGestureRecognizer:[[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(control:)]];
[self addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(control:)]];

In most cases this works fine, but in some cases the Pan gesture isn't recognized by the UIView subclass, but triggers the drawer to open. The Tap gesture works in all cases without any problems. Restarting the App solves the problem, so its unclear what causes the issue.

Any idea's?

erichoracek commented 10 years ago

Take a look at the UIGestureRecognizerDelegate methods below:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer

Hopefully they'll be the answer to your issue.

MichMich commented 10 years ago

Thanks! I'll dive into it. Thumbs up!

MichMich commented 10 years ago

For furture reference: I solved this issue by using

[drawerViewController registerTouchForwardingClass[UIViewSubClass class]];