Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5975767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:07:58+00:00 2026-05-22T21:07:58+00:00

I would like to present a view controller modally before calling -makeKeyAndVisible on the

  • 0

I would like to present a view controller modally before calling -makeKeyAndVisible on the application’s window. However, this code only shows the mainNav view controller:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    MainViewController *main = [[MainViewController alloc] init];
    UINavigationController *mainNav = [[UINavigationController alloc] initWithRootViewController:main];

    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"Restore"]) 
    {
        DetailViewController *detail = [[DetailViewController alloc] init];
        UINavigationController *detailNav = [[UINavigationController alloc] initWithRootViewController:detail];

        // changing main to mainNav does not help
        [main presentModalViewController:learnNav animated:NO];

        [detailNav release]; [detail release];

    }

    self.window.rootViewController = mainNav;

    [main release]; [mainNav release];

    [self.window makeKeyAndVisible];

    return YES;
}

What am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:07:59+00:00Added an answer on May 22, 2026 at 9:07 pm

    You should better make the window appear and then present the modal view with animated=NO. What’s the point of presenting the modal view before everything else is instantiated and displayed?

    Edit

    To try to make your code work, here are a couple of hints. Try this:

    [mainNav presentModalViewController:learnNav animated:NO];
    

    or this:

    [main.navigationController presentModalViewController:learnNav animated:NO];
    

    I’d say that these two methods work best if they’re put after the makeKeyAndVisible call.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UINavigationControl and I would like to present a view controller pushing
I have a view controller that I would like to present in a modal
In my application, I would like a modal view to present itself when the
I would like to check what colors is present in a image. This will
Before iOS4, my app's initial view controller would check a passcode on/off settings variable
Is there a way to present a modal view controller view before an action
I would like to use CSS to present a two-column layout. The markup I
If you have some blocks of code that you would like to prevent execution
I would like to create a scrollview inside of another view. I put a
I would like to present multiple modal views in sequence (e.g. show confirmation page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.