Closed ArVan closed 11 years ago
You should implement the SASlideDataSource method:
-(Boolean) disablePanGestureForIndexPath:(NSIndexPath*) indexPath;
You return YES only for the ViewControllers that does not use the pan gesture. The Static example uses this feature, the DarkViewController uses a slider thus the pan gesture is disabled:
-(Boolean) disablePanGestureForIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row ==0) {
// This is the DarkViewController that uses a slider
return YES;
}
return NO;
}
ok, so in that case pan gesture would be inactive for my whole controller. It's nice. But what if I still want to have the gesture in controller and want my slider to work? Isn't it possible to stop pan gesture only when I'm touching specific element?
The current implementation only support disabling the pan gesture for the whole controller. Maybe it is possible to selectively define the pan gesture recognizer like you are suggesting, however it is not supported by the current SASlideMenu implementation.
ok, thank you
I have some code that might get you on the right track. In SASlideMenuContentSegue.m if you replace
[destination.view addGestureRecognizer:panGesture];
with
if([[destination.viewControllers objectAtIndex:0] isKindOfClass:[UITableViewController class]])
[(UIView*)destination.navigationBar addGestureRecognizer:panGesture];
else [destination.view addGestureRecognizer:panGesture];
This will check to see if the controller being attached is a subclass of UITableViewController and only enable the swipe gesture for the navigation bar if that is the case. It prevents the swipe to delete gesture on UITableViewCells from responding to SASlideMenu. Maybe some variation of this could solve your problem.
I would pull request this but not every tableView uses swipe to delete.
Exactly, the problem is that it is difficult to define a general rule for enabling/disabling the pan gesture. I added the disablePanGestureForIndexPath: to allow the developers to deactivate the pan gesture depending o their needs. It will be even more flexible if it will be possible to deactivate the pan gesture only on selected view, as suggested by ArVan, but I have not found a reasonably simple solution yet.
Hi master of sliding :)
What to do if there is a slider in view controller and it won't slide because the gesture is taken by slideMenu? I thought about adding some code to my custom UISlider to fire a notification, which will be caught by my SASliderVC. But I'm not sure what's the methot that will disable/enable swipe gesture recognizer on SliderMenu. Is there one?