Open ahmedsafadii opened 8 years ago
I created a pull-request just for that.
i fix it by edit 1 line in UIViewController.swift file
func setNavigationBarItem() { //self.addLeftBarButtonWithImage(UIImage(named: "ic_notifications_black_24dp")!) self.addRightBarButtonWithImage(UIImage(named: "ic_menu_black_24dp")!) self.slideMenuController()?.removeLeftGestures() self.slideMenuController()?.removeRightGestures() self.slideMenuController()?.addLeftGestures() self.slideMenuController()?.addRightGestures() }
@ahmedsafadii yours is a better solution
@hlandao if you want to load the left or right menu in custom controller i can help u with that
;)
Why this can't be done? I wanted to enable the right menu just when the user is logged in.
In that case, I think a solution should be provided in the README since this is a trivial case. Or this PR accepted.
@pbassut did it work for you ?
It did. I'm not sure if removing and adding gesturerecognisers is a hackish way though.
Let's wait for the author. And thank you for your help, @ahmedsafadii .
@pbassut , I need to implement the same use case. I'm not clear how you did that. How did you disable the right side menu and enable it again ?
@leizard just call self.slideMenuController()?.removeLeftGestures()
@leizard as @pbassut said in the file
UIViewController.swift
comment this line
//self.addLeftBarButtonWithImage(UIImage(named: "ic_notifications_black_24dp")!)
Thanh you @pbassut, @ahmedsafadii for your support. So, call removeLeftGestures() to disable right menu ? It seem not work to me, this is my slide menu set up method put in AppDelegate.swift
func setUpSideMenu() {
let screenWidth = UIScreen.mainScreen().bounds.size.width
SlideMenuOptions.hideStatusBar = false
SlideMenuOptions.leftViewWidth = (80*screenWidth)/100
SlideMenuOptions.rightViewWidth = (80*screenWidth)/100
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let mainViewController = storyboard.instantiateViewControllerWithIdentifier("mainNavigationViewController")
let leftViewController = storyboard.instantiateViewControllerWithIdentifier("LeftMenuController") as! LeftMenuController
let rightViewController = storyboard.instantiateViewControllerWithIdentifier("RightMenuController") as! RightMenuController
let slideMenuController = SlideMenuController(mainViewController: mainViewController, leftMenuViewController: leftViewController, rightMenuViewController: rightViewController)
slideMenuController.removeLeftGestures()
self.window?.rootViewController = slideMenuController
self.window?.makeKeyAndVisible()
}
Everything works fine instead slideMenuController.removeLeftGestures()
not disable anything. Please tell me where I'm wrong.
Thank you very much.
Ok I did it. just call self.slideMenuController()?.removeRightGestures() in each view controller which have right slide menu. I think it will be awesome if we can enable/disable slide menu globally :D. Thank you guys very much for your information.
how i can disable left menu in one controller !?