ios change storyboard default view controller at run time

ios, storyboard, uiviewcontroller

Solution

@Martol1ni I wanted to use your answer, but I also wanted to stay away from unnecessary storyboard clutter so I tweaked your code a bit. However I did give you a +1 for your inspiring answer.

I put all of the following on the default controller.

- (void)gotoScreen:(NSString *)theScreen
{
    AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication] delegate];

    UIViewController *screen = [self.storyboard instantiateViewControllerWithIdentifier:theScreen];
    [app.window setRootViewController:screen];
}

And then where the logic happens I'll call the following as needed.

if(myBool == YES) {
    [self gotoScreen:@"theIdentifier"];
}

Problem

It it possible to override the default view controller from a storyboard to show a different controller instead? This would all happen in the AppDelegate of course.

Original source