I am trying to change the view controller from my AppDelegate like this:
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc = [storyBoard instantiateInitialViewController];
NSLog(@"ViewController: %@",vc);
self.window.rootViewController = vc;
NSLog(@"ViewController: %@",self.window.rootViewController);
However the screen remains black. Here are my NSLogs:
ViewController: MyViewController
ViewController: (null)
It seems your self.window is nil. Are you sure you did not forget to create it?
self.window = [ [ UIWindow alloc ] initWithFrame:[ [ UIScreen mainScreen ] bounds ] ];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With