I have a SplitViewController based application that calls other UIViewController users to display them by replacing in the details section ...
I send them parameters, information, objects, and everything works fine using segues from MasterViewController
But some of my UIViewControllers interact with other UIViewControllers using Segues, so to make them work fine, I need to embed them in the UINavigationController
my question is:
How to add a UINavigationController to my segue.destinationViewController when segue is executed for:
- Passing them my parameters from masterViewController
- Allow my UIViewControllers to interact with other ViewControllers using Segues
I thought in the solution: -Producing parameters by creating custom delegates or protocols in MasterViewController -UINavigationControllers Institution adds them to the development mode in the storyboard, embedding my UIViewControllers in them
but I need to set a UISplitViewController delegate to my destinationViewController to display a button that displays the MasterViewController in portrait mode ...
if I set this in the prepareForSegue method, having a UINavigationControllers holding my ViewControllers, I will set the UISplitViewController delegate instead of the UINavigationController
in advance for help
EDIT: this was the way I found to solve it:
At first I assigned IBAction to the button, if my device is not an iPad, it will do the usual seg ...
- (IBAction)openExecutives:(id)sender { if ([[[UIDevice currentDevice]model] hasPrefix:@"iPad"]) { UsersListVC *rightViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"UsersListVC"]; [self showSplitViewController:rightViewController]; } else [self performSegueWithIdentifier:@"viewSceneExecutives" sender:self]; }
This is a feature that I developed to create a SplitView with my custom granularity ...
-(void)showSplitViewController:(id)rightViewController{ UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"iPad2" bundle: nil]; UINavigationController *leftNavController; UINavigationController *rightNavController; MainMenuVC *leftViewController = [mainStoryboard instantiateViewControllerWithIdentifier:@"MainMenuVC"]; leftNavController = [[UINavigationController alloc] initWithRootViewController:leftViewController]; rightNavController = [[UINavigationController alloc] initWithRootViewController:rightViewController]; leftNavController.toolbarHidden = FALSE; rightNavController.toolbarHidden = FALSE; UISplitViewController *splitViewController = [[UISplitViewController alloc] init]; splitViewController.viewControllers = [NSArray arrayWithObjects:leftNavController, rightNavController, nil]; splitViewController.delegate = rightViewController; self.view.window.rootViewController = splitViewController; }
All I did was redraw the splitViewController from the start, creating a function that requires a parameter (UIViewController)