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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:06:41+00:00 2026-05-23T22:06:41+00:00

I am building an app that has a login screen that leads to a

  • 0

I am building an app that has a login screen that leads to a tabbar. I followed this example on how to push a modal view once you launch the app (as the “sign in” page) and then dismiss it.

Example –> Show / Hide tab bar

From some reason, it’s not really working – when I launch the app, I see the tabbar view with the two view controllers. no sign in page.

here is my code:

AppDelegate:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIViewController *viewController1 = [[FirstTab alloc] initWithNibName:@"FirstTab" bundle:NSBundle.mainBundle];
UIViewController *viewController2 = [[SecondTab alloc] initWithNibName:@"SecondTab" bundle:NSBundle.mainBundle];
UINavigationController *secondNavController = [[UINavigationController alloc]initWithRootViewController:viewController2];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, secondNavController, nil];

self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;

}

My first tab (which is where I understand all this modal view business needs to happen)

.h

@interface FirstTab : UIViewController

@end

.m

//UPDATED CODE PER COMMENT BELOW

- (void)viewDidLoad
{
[super viewDidLoad];
SignIn *loginview = [[SignIn alloc] initWithNibName:@"SignIn" bundle:nil];
UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController: loginview];
self.hidesBottomBarWhenPushed = YES; 
[self presentModalViewController:controller animated:YES]; 

}

And of course, I dismiss the modal view in the SignIn view controller, though I never get there as I mentioned.

What am I doing wrong here? Thanks for the help!!

  • 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-23T22:06:42+00:00Added an answer on May 23, 2026 at 10:06 pm

    You could use :

    [[self tabBarController] presentModalViewController:controller animated:YES];
    

    since first viewController1 is your first tab, and self.navigationController might be nil.

    In your custom view controller subclass called SignIn implement initWithNibName:bundle: instead if init.

    -(id)initWithNibName:(NSString *)nibNameOrNil
                  bundle:(NSBundle *)nibBundleOrNil {
        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
        if (self) {
            // init here
        }
    }
    

    Now when init/alloc it call either :

    SignIn *loginview = [[SignIn alloc] initWithNibName:@"SignIn" bundle:nil];
    

    if your interface is in a NIB file, or :

    SignIn *loginview = [[SignIn alloc] initWithNibName:nil bundle:nil];
    

    if there no NIB.

    Also why putting it as a root view controller of any navigation controller ? unless you need to go deeper in some model data presentation, just present it directly :

    // why ?
    //UINavigationController *controller = [[UINavigationController alloc]
    //                                      initWithRootViewController: loginview];
    //self.hidesBottomBarWhenPushed = YES; 
    //[self presentModalViewController:controller animated:YES];
    [self presentModalViewController:loginView animated:YES]; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I'm building an iOS4 app that has a login screen and has to
I am building an iPad app that has a split view controller. Is it
I am currently building an app that has 6 images on the main view
I need some advice. I’m building an app that has a sequence of 4
I'm building a Rails app that has Etsy.com style functionality. In other words, it's
I'm building an app that currently has 3 ViewControllers. One of them is used
I'm building a new web app that has a requirement to generate an internal
I am building a FB canvas app that has share functionality, my plan is
The app I'm currently building has the requirement that the app has to prevent
The app we're building has a simple button that starts a facetime session with

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.