Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start an iOS app with a modal view controller already presented without the user being able to see the presenting view?

I've tried many combinations of doing this from the app delegate, the presenting view controller's viewDidLoad, with and without delay, with and without animation.

But either the user can see the presenting view controller for a moment, or the modal doesn't get presented.

How can this be achieved?

like image 334
abc123 Avatar asked Oct 20 '13 16:10

abc123


1 Answers

Tried code below with storyboard, app starts with modal view controller:

AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [self.window makeKeyAndVisible];
    [self.window.rootViewController performSegueWithIdentifier:@"modalSegue" sender:self];

    return YES;
}

Segue configuration from start view controller to modal view controller:

enter image description here

like image 184
LorikMalorik Avatar answered Jan 04 '23 06:01

LorikMalorik