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 8906701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:43:22+00:00 2026-06-15T02:43:22+00:00

In my app I would like to show a login screen – which will

  • 0

In my app I would like to show a login screen – which will be displayed when the app starts and when the app becomes active. For reference, I am using storyboards, ARC and it is a tabbed bar application.

I therefore need to do the process in the applicationDidBecomeActive method:

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    if ( ... ) { // if the user needs to login
        PasswordViewController *passwordView = [[PasswordViewController alloc] init];
        UIViewController *myView = self.window.rootViewController;
        [myView presentModalViewController:passwordView animated:NO];
    }
}

To an extent this does work – I can call a method in viewDidAppear which shows an alert view to allow the user to log in. However, this is undesirable and I would like to have a login text box and other ui elements. If I do not call my login method, nothing happens and the screen stays black, even though I have put a label and other elements on the view.

Does anyone know a way to resolve this? My passcode view is embedded in a Navigation Controller, but is detached from the main storyboard.

  • 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-06-15T02:43:23+00:00Added an answer on June 15, 2026 at 2:43 am

    A variety of answers finally led me to an answer which doesn’t seem too complicated so I will post it here – and it actually looks really good if I am honest.

    Firstly, my password view is embedded in a Navigation Controller (Editor -> Embed In) and this is connected to the main tab bar controller using a modal segue with an id, in my case ‘loginModal’.

    In the applicationDidBecomeActive method put something like this:

    [self performSelector:@selector(requestPasscode) withObject:nil afterDelay:0.2f];
    

    And then put this function somewhere in the App Delegate

    -(void)requestPasscode{
        if ( /* If the user needs to login */ ) {
            [self.window.rootViewController performSegueWithIdentifier:@"loginModal" sender:self];
        }
    }
    

    This will present your login view whenever the app begins or enters the foreground (for example, when switching apps).

    NOTE: The above line will not work if the root of your app is embedded in a navigation controller.

    There are however two bugs;

    1. If the user was previously viewing a modal view when they dismissed the app
    2. If the user dismissed the app on the password view.

    Both of these cause the app to crash so the following line goes in the applicationWillResignActive method.

    [self.window.rootViewController dismissViewControllerAnimated:NO completion:nil];
    

    It basically dismisses all modal views that are presented. This may not be ideal, but modal views are more often then not, used for data entry and so in many cases, this is a desired effect.

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

Sidebar

Related Questions

I'm using jQuery mobile with PhoneGap, and would like to show a login page
I would like to show a progress view while my app is downloading files
In my web app, I would like to show an Admin menu link only
I have a WPF App that implements a ListView. I would like to show
I am using matplotlib in a django app and would like to directly return
I would like to create a simple AIR app that show's a notification on
I would like to setup a multi-tenant ASP.NET MVC app. Ideally, this app would
I would like to use Public/Private encryption where my web app would sign an
In my app i would like to download images and songs from server url
I have an iPhone app and would like to create iPad version of it.

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.