evnaz / ENSwiftSideMenu

A simple side menu for iOS written in Swift.
MIT License
1.82k stars 282 forks source link

Is it possible to show left menu button on each screen ? #170

Open Shahbaz-Akram opened 7 years ago

omerCoosto commented 6 years ago

A way of doing it: On your UIViewController class inherit this "CustomMenuItemViewController" class to have the left menu button

class CustomMenuItemViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        setupMenuButton()
    }

    func setupMenuButton() {
        let menuButton = UIBarButtonItem(image: #imageLiteral(resourceName: "menu"), style: .plain, target: self, action: #selector(showMenuAction(_:)))
        navigationItem.leftBarButtonItem = menuButton
    }

    @IBAction func showMenuAction(_ sender: Any) {
        toggleSideMenuView()
    }
}

(this question has been here for a while but maybe for other that can be helpful)