Note that there are some explanatory texts on larger screens.

plurals
  1. POLandscape UISplitViewController when using a UINavigationController in the detail
    text
    copied!<p>I am developing an iPad/Universal application, and I am facing the problem of handling a UINavigationController as the main detail view in a UISplitViewController. What I want to know is how to add the default side controller button to the detail controller when in landscape orientation.</p> <h3>Definition</h3> <p>The split view controller has been defined this way:</p> <pre><code>splitViewController = [[UISplitViewController alloc] init]; SideController *root = [[[SideController alloc] init] autorelease]; DetailController *detail = [[DetailController alloc] init]; InserisciDatiController *calcolo = [[[InserisciDatiController alloc] initWithNibName:@"InserisciDatiNuovi" bundle:[NSBundle mainBundle]] autorelease]; UINavigationController *rootNav = [[[UINavigationController alloc] initWithRootViewController:root]autorelease]; UINavigationController *calcoloNav = [[[UINavigationController alloc] initWithRootViewController:calcolo] autorelease]; splitViewController.viewControllers = [NSArray arrayWithObjects:rootNav, calcoloNav, nil]; splitViewController.delegate = detail; </code></pre> <p>and later on I release all the releasable objects. I am using the <code>SideController</code> as a sort of index for the detail controller. It has a table view, and clicking each row I update the main view controller of the detail. Each new controller is always an instance of UINavigationController.</p> <h3>Update the detail</h3> <pre><code>myAppDelegate *delegate = (myAppDelegate *)[[UIApplication sharedApplication] delegate]; UINavigationController *nav = (UINavigationController *)[delegate.splitViewController.viewControllers objectAtIndex:1]; [nav setViewControllers:[NSArray arrayWithObjects:controller, nil]]; </code></pre> <p>I use this piece of code to update the detail controller, when the user taps a row in the side view controller.</p> <h3>Handle landscape orientation</h3> <p>I'd like to know how to handle the landscape orientation, when I want to add the default toolbar button to display the hidden side view controller. What I am not able to do is getting the toolbar of the detail navigation controller to add the button using this method:</p> <pre><code>- (void)splitViewController:(UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController:(UIPopoverController*)pc </code></pre> <p>And also, when I push a new controller to the navigation controller the default back button will appear in the toolbar. In this case how should I handle the button creation?</p> <h2>Update</h2> <p>Please, do not tell me that no-one has ever had this kind of problem! How do you develop iPad apps? Sob ...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload