i am using navigation controller and Navigation drawer controller on the same UIViewController but i don't know how to open the navigation drawer on the click of the menu button. Someone suggest me please.
Referenced from this sample project NavigationDrawer you can add handlers to a button that use the toggle*
methods.
@objc
internal func handleMenuButton() {
navigationDrawerController?.toggleLeftView()
}
@objc
internal func handleMoreButton() {
navigationDrawerController?.toggleRightView()
}
The toggle methods observe the state of the NavigationDrawer
and then switch to the opposite state. For example, if it is opened
it will close
, and if it is closed
it will open.
If you want to open or close no matter the state, then you can use the open* and close* methods directly.
navigationDrawerController?.openLeftView()
navigationDrawerController?.closeLeftView()
navigationDrawerController?.openRightView()
navigationDrawerController?.closeRightView()
You can see the entire source code here.
That's it, all the best :)