I want to detect when the menu is closed. I found this SO solved question. In the comments of the accepted answer, they say that this method:
-(void)setGestureCompletionBlock:(void(^)(MMDrawerController * drawerController, UIGestureRecognizer * gesture))gestureCompletionBlock;
have to be in the App delegate in order to be notified when the menu is closed. I putted this function in my App delegate, and in it's implementation I made a NSLog(@"menu closed"); but nothing is printed in my console and the function is not fired when I close the menu.
Can anyone explain me please how can I detect that the menu is closed? (Based on the given answer or if you have another one)
Edit:
In the storyboard, I have an UINavigationController linked to an UIViewController having as type the MMDrawerController (myVCMMdrawerController), then I have also myCenterVC, the leftVC and the rightVC. In the myVCMMdrawerController viewDidLoad this is what I do:
MyCenterVC * centerVC = [[self storyboard] instantiateViewControllerWithIdentifier:@"myCenterVC"];
centerVC.drawerController = self;
LeftVC * leftVC = [[self storyboard] instantiateViewControllerWithIdentifier:@"leftVC"];
leftVC.drawerController = self;
self.centerViewController = centerVC;
self.leftDrawerViewController = leftVC;
self.showsShadow = false;
//[self setMaximumLeftDrawerWidth:[UIScreen mainScreen].bounds.size.width animated: true completion: nil];
//enable gesture
self.openDrawerGestureModeMask = MMOpenDrawerGestureModeAll;
self.closeDrawerGestureModeMask = MMCloseDrawerGestureModeAll;
[self closeDrawerAnimated:NO completion:nil];
In myCenterVC I make the actions to display the menu in IBActions like this:
[self.drawerController toggleDrawerSide:MMDrawerSideLeft animated:true completion:nil];
here's the code that works for me :
Swift 3.0+
}
You may have to ensure that you set
and check if
drawer's openSide is leftelse its closed.Objective-C