Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable drawer open and close #518

Open
Mahesh160393 opened this issue Jan 7, 2019 · 2 comments
Open

How to disable drawer open and close #518

Mahesh160393 opened this issue Jan 7, 2019 · 2 comments

Comments

@Mahesh160393
Copy link

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
Copy link
Author

@danmurrelljr help me

@maniarali
Copy link

maniarali commented Feb 19, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants