I have a program with a navigation controller and a default RootViewController. If I do nothing programmatically, the application starts up and the RootViewController works as I expect, for example, as shown below:

The problem I encountered is to enable an additional StartController. I want this: In my AppDelegate (didFinishLaunchingWithOptions), I want to have a code like this:
UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"OptionalStartViewController"]; self.window.rootViewController = viewController; [self.window makeKeyAndVisible];
To show the optional start of the ViewController first. Then, after the user finishes working with the additional view controller, they will be able to display the RootViewController.
So, in the optional launch of ViewController, I added code similar to this to show the Root View controller:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil]; UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"RootViewController"]; [self appDelegate].window.rootViewController = viewController; [[self appDelegate].window makeKeyAndVisible];
All this works except when the RootViewController, if shown, does not have navigation controls as expected (i.e. the view is displayed without navigation controls).
I also tried the code below (using UINavigationController instead of ViewController) with the same results ...
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil]; UINavigationController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"HomeViewController"]; [self appDelegate].window.rootViewController = viewController; [[self appDelegate].window makeKeyAndVisible];
Another twist ... there may be a few additional initial view controllers.
Any ideas?
source share