Sebastian Boldt
Sebastian Boldt

Reputation: 5321

Show specific viewcontroller after Application started

i want to show uo a viewcontroller connected via a seque from the first view of the rootviewcontroller which is a navigation controller. I tried the following code. But it doesnt work for me : [_window.rootViewController.navigationController performSegueWithIdentifier:@"showLoginScreen" sender:self];

What i am doing wrong : Here is a screen shot of my storyboard connections :

click here

I want to show the MainViewController after startup.

Upvotes: 0

Views: 127

Answers (1)

petert
petert

Reputation: 6692

Have you tried something along the following lines:

MainViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"ShowLoginScreen"];

[self.navigationController pushViewController:controller animated:YES];

You need to obtain a reference to the view controller via the storyboard.

Upvotes: 1

Related Questions