0

I am using CosmicMind/Material with a SideMenu, like in this example: here, but I can not figure out how to change (load) another view controller when I push a cell of the Menu.

To illustrate, in the example Material/Example/App, I would like to click on "inbox" and load the InboxViewController.

Edric
  • 24,639
  • 13
  • 81
  • 91
papay0
  • 1,311
  • 1
  • 12
  • 25
  • Checkout this question and answer http://stackoverflow.com/questions/35647528/how-to-implement-a-sidenavigationviewcontroller-into-a-uiviewcontroller – CosmicMind Feb 26 '16 at 16:06

1 Answers1

2

To change the mainViewController area of the SideNavigationViewController, use the

transitionFromMainViewController

method.

You would also need a reference to the SideNav... and to get one from any UIViewController, you can use the Optional property

sideNavigationViewController?.transitionFromMainViewController(InboxViewController())

That's all it takes.

CosmicMind
  • 1,499
  • 1
  • 10
  • 6
  • It works, but is it possible to have a working example (in Example/App?), so that we can see how to use Material with the best practices, close the menu and so on ..? – papay0 Feb 24 '16 at 21:56
  • Yeah, I use a NavigationBarViewController as the mainViewController in the example App project. So rather than switch the SideNav, I switch the Nav mainViewController. More examples are coming :) – CosmicMind Feb 24 '16 at 22:24
  • Checkout this question and answer http://stackoverflow.com/questions/35647528/how-to-implement-a-sidenavigationviewcontroller-into-a-uiviewcontroller – CosmicMind Feb 26 '16 at 16:07