How to disable drawer open and close
Opened this issue · 2 comments
Mahesh160393 commented
Is it possible to disable open/close by swiping?
I want to disable swipe. when we click on UIBarButtonItem then it will open.
Thank You in advance
Mahesh160393 commented
@danmurrelljr help me
maniarali commented
My solution to this problem is creating extension in your UIViewController like this:
extension UIViewController {
func enableSideMenu() {
if self.mm_drawerController != nil {
self.mm_drawerController.openDrawerGestureModeMask = .bezelPanningCenterView
}
}
func disableSideMenu() {
if self.mm_drawerController != nil {
self.mm_drawerController.openDrawerGestureModeMask = .init(rawValue: 0)
}
}
}
After this in whatever view controller you want to disable your side menu call
self.disableSideMenu()
and to re-enable
self.enableSideMenu()
For Example:-
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.disableSideMenu()
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
self.enableSideMenu()
}
I hope this is helpful