Clancey / FlyoutNavigation

Other
95 stars 87 forks source link

Change viewcontrollers to existing ones #64

Closed TheDutchBeast closed 9 years ago

TheDutchBeast commented 9 years ago

Dear all. I can not seem to understand how to change the following code to already existing viewcontrollers ( such as timetableViewController and optionsViewController(I have made them myself):

var navigation = new FlyoutNavigationController { // Create the navigation menu NavigationRoot = new RootElement("Navigation") { new Section ("Pages") { new StringElement ("Animals"), new StringElement ("Vegetables"), new StringElement ("Minerals"), } }, // Supply view controllers corresponding to menu items: ViewControllers = new[] { new UIViewController { View = new UILabel { Text = "Animals (drag right)" } }, new UIViewController { View = new UILabel { Text = "Vegetables (drag right)" } }, new UIViewController { View = new UILabel { Text = "Minerals (drag right)" } }, }, }; // Show the navigation view navigation.ToggleMenu(); View.AddSubview(navigation.View);

Does anybody have any idea?

Clancey commented 9 years ago

var navigation = new FlyoutNavigationController { // Create the navigation menu NavigationRoot = new RootElement("Navigation") { new Section ("Pages") { new StringElement ("Timetable"), new StringElement ("Options"), } }, // Supply view controllers corresponding to menu items: ViewControllers = new[] { new UINavigationController(new timetableViewController()) , new UINavigationController(new optionsViewController()) , }; // Show the navigation view navigation.ToggleMenu(); View.AddSubview(navigation.View);

TheDutchBeast commented 9 years ago

Did not work

TheDutchBeast commented 9 years ago

I get the following error: 'Ola.iOS.TimeTableViewController' does not contain a constructor that takes 0 arguments. These ViewControllers I mentioned, are classes coupled to a viewcontroller in the storyboard. They already exist and are completely designed

Clancey commented 9 years ago

var storyboard = UIStoryboard.FromName (storyboardName,null); var vc = storyboard.InstantiateViewController(viewControllerStoryBoardId); If you need more info than that, just google for Instantiating UIViewController from storyboard.

TheDutchBeast commented 9 years ago

Dont see to get it, but thank you anyway :)

Clancey commented 9 years ago

I just updated the sample to show loading from a storyboard