I am trying present ViewController I have created with StoryBoards:
AuthViewController *authViewController = [[AuthViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:authViewController];
UIViewController *vc = [[[[UIApplication sharedApplication] windows] firstObject] rootViewController];
[vc presentViewController:nav animated:YES completion:nil];
But getting it with black screen. What could be the issue?
Alloc init AuthViewController
does not mean that will create a view layout for controller.
Here view controller does not load its view that's why you are getting black screen. Use storyboard object and identifier of view controller to load its view.
Specify storyboard identifier in Storyboard of AuthViewController
controller.
Add Storyboard ID
and mark true
for Use Storyboard ID
option like in below image:
Now get AuthViewController
controller object using below code:
AuthViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"AuthViewController"];
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