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.
Asked
Active
Viewed 253 times
1
-
I am pushing an example with this in a moment. – CosmicMind Oct 08 '16 at 20:36
-
why it is down voted?? – Ayush sharma Oct 09 '16 at 13:05
-
No idea. This is a good question. – CosmicMind Oct 09 '16 at 14:52
1 Answers
2
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 :)

CosmicMind
- 1,499
- 1
- 10
- 6
-
Please mark the answer, so others know this is the correct solution. Thank you :) – CosmicMind Oct 09 '16 at 14:52