I have a Storyboard application that the root view controller is a UITableViewController
.
Sometimes when I launch the application I need to present a view controller (that doesn't need a nib or anything). This is how I'm trying to do that:
In my UIApplicationDelegate
application:application didFinishLaunchingWithOptions:
:
SplashViewController * splashViewController = [[SplashViewController alloc] init];
splashViewController.semaphore = semaphore;
[self.window.rootViewController presentViewController:splashViewController animated:NO completion:nil];
The problem is, in this moment the UITabBarController
is not yet in the view hierarchy, so I get this warning:
Warning: Attempt to present <SplashViewController: 0xa786a10> on <UITabBarController: 0xb35d830> whose view is not in the window hierarchy!
Moving this code from the AppDelegate to the viewDidLoad
of the first view controller of the UITableViewController
doesn't seen to be right, as I would need to create some properties in my AppDelegate just to make my first view controller build that view. This logic doesn't fit there.
What would be the proper way to present this view controller?