According to the material.io documentation, the Modal Navigation Drawer should be used for sideMenus on mobile device but their api almost only contain drawers for the bottom, MDCBottomDrawerViewController
, MDCBottomDrawerPresentationController
etc. What about the side drawer? I checked but didn't find a MDCSideDrawerViewController
.
The following code uses the MDCBottomDrawerViewController
, but the problem is that the MDCBottomDrawerViewController().contentViewController
presents my table from the botton instead of the from the side.
Set up for bottomDrawVC:
var bottomDrawerViewController: MDCBottomDrawerViewController = {
let drawer = MDCBottomDrawerViewController()
drawer.isTopHandleHidden = false
drawer.dismissOnBackgroundTap = true
return drawer
}()
The presenting of the bottomDrawVC:
@IBAction func toggleSideMenu() {
let storyBoard = UIStoryboard.init(name: "Main", bundle: nil)
let vc = storyBoard.instantiateViewController(withIdentifier: "TableViewController")
let size = CGSize(width: view.frame.width, height: view.frame.height)
bottomDrawerViewController.contentViewController?.preferredContentSize = size
bottomDrawerViewController.contentViewController = vc
present(bottomDrawerViewController, animated: true, completion: nil)
}
As I can't seem to find info in the docs, how does one present a modal side menu with material.io on iOS?