Ahmed Safadi
Ahmed Safadi

Reputation: 453

how i can disable the right menu on one controller

recently i used this library to make slide menu , what i found that this library give me slide from right and left

https://github.com/dekatotoro/SlideMenuControllerSwift

what if i want to disable the right menu

or if i want to show it in only one controller

i try to disable it by doing this

i delete the rightViewController but the action still work and show me black screen

    let storyboard = UIStoryboard(name: "Main", bundle: nil)

    let mainViewController = storyboard.instantiateViewControllerWithIdentifier("SignInViewController") as! SignInViewController
    let leftViewController = storyboard.instantiateViewControllerWithIdentifier("LeftViewController") as! LeftViewController

    let nvc: UINavigationController = UINavigationController(rootViewController: mainViewController)


    let slideMenuController = SlideMenuController(mainViewController:mvc, leftMenuViewController: leftViewController)

Upvotes: 0

Views: 560

Answers (2)

Jobins John
Jobins John

Reputation: 1278

Just delete these two methods from your code and that will do the trick

self.slideMenuController()?.openRight() self.slideMenuController()?.closeRight()

Its clearly mentioned in the github documentation.

Hope this helps you...

Upvotes: 0

Ahmed Safadi
Ahmed Safadi

Reputation: 453

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()
}

^_^

Upvotes: 1

Related Questions