views:

210

answers:

0

Creating a new app based on the SplitViewController template and it works fine in Split View.

My main screen is to be a non-splitview 'menu'. I'm trying to figure out the best practice for adding this 'mainMenu' modally above the splitViewController. (Then either push other non-split views above the mainMenu or remove it to reveal and use the UISplitViewController.)

I have tried:

[self.navigationController presentModalViewController:mainMenu animated:NO];

And

[self presentModalViewController:mainMenu animated:NO];

In the viewWillAppear and viewWillLoad methods for rootViewController & detailViewController. In both cases, the code executes without error, but the mainMenu doesn't appear, the regular detailViewController and rootViewControllers appear.

(I did create an outlet from the navigationController in the main.xib file to the detailView navigationController, but that didn't change anything.)

I was able to make this work by using, which works, but seems like it is incorrect.

iPad_Prototype_SplitAppDelegate *delegate = (iPad_Prototype_SplitAppDelegate *) [   [UIApplication sharedApplication] delegate];

[delegate.splitViewController.view addSubview:mainMenu.view];
[delegate.splitViewController.view bringSubviewToFront:mainMenu.view];

I've seen many responses saying to present such a covering view modally, but I can't seem to find the right place or configuration in the splitViewController setup. Thanks for any help or insight.

Finally, is this approach wrong, should I just be swapping out the detailViewController and having it take full screen in portrait mode and not add the menu item for the root controller?