carlosx2
carlosx2

Reputation: 1835

disable mmdrawer viewcontroller menu in swift

I made a two menus in my swift app with mmdrawer. They work perfectly, however i would like to disable the left menu on certain pages. I found the following code to do this

appDelegate.centerContainer!.leftDrawerViewController = nil

It works but it lock all the menus on all other viewcontrollers while i would like it only to lock the let menu on that page and no other. I tried to figure out how reinitiate mmdrawer after that but it doesn't work.

Who can help me with the proper code to get this working.

thanks

Upvotes: 2

Views: 495

Answers (1)

carlosx2
carlosx2

Reputation: 1835

After some testing and digging i found a solution for my problem that others might help when they face the same issue.

I used the following piece of code to reactivate my left menu after i disabled it.

let leftViewController = self.storyboard?.instantiateViewControllerWithIdentifier("LeftSideViewController") as! LeftSideViewController

        let leftSideNav = UINavigationController(rootViewController: leftViewController)

        let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate

        appDelegate.centerContainer!.leftDrawerViewController = leftSideNav

Upvotes: 1

Related Questions