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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:51:48+00:00 2026-06-16T04:51:48+00:00

I need to add a tabbarcontroller with ViewControllers when Facebook login is successful.BUt Couldn’t

  • 0

I need to add a tabbarcontroller with ViewControllers when Facebook login is successful.BUt Couldn’t understand how?

I have in appDelegate.m:

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

SearchView *first=[[SearchView alloc]
                                initWithNibName:@"SearchView" bundle:nil];


    Login *second=[[Login alloc]initWithNibName:@"Login" bundle:nil];
    second.title=@"Login";
    NSArray *viewArray=[[NSArray alloc] initWithObjects: first,second,nil];
    tabBarController=[[UITabBarController alloc] init];
    [tabBarController setViewControllers:viewArray animated:NO];
    [self.window addSubview:tabBarController.view];
    [self.window makeKeyAndVisible];
    [viewArray release];
    [first release];
    [second release];    
    return YES;


}




}
- (void)sessionStateChanged:(FBSession *)session
                      state:(FBSessionState) state
                      error:(NSError *)error
{
    switch (state) {
        case FBSessionStateOpen:
            if (!error) {
                FBLogin *fblogin=[[FBLogin alloc]initWithNibName:@"FBLogin" bundle:nil];
               [self.window addSubview:fblogin.view];
 }
            break;
        case FBSessionStateClosed:
        case FBSessionStateClosedLoginFailed:
            [[FBSession activeSession] closeAndClearTokenInformation];
            break;
        default:
            break;
    }

    [[NSNotificationCenter defaultCenter]
     postNotificationName:FBSessionStateChangedNotification
     object:session];

    if (error) {
        UIAlertView *alertView = [[UIAlertView alloc]
                                  initWithTitle:@"Error"
                                  message:error.localizedDescription
                                  delegate:nil
                                  cancelButtonTitle:@"OK"
                                  otherButtonTitles:nil];
        [alertView show];




    }
}

In FBLogin.m :
-(void)viewDidAppear:(BOOL)animated
{

            SearchView *searchViewController=[[SearchView alloc]initWithNibName:@"SearchView" bundle:nil];
            UserProfile *userprofile=[[UserProfile alloc]initWithNibName:@"UserProfile" bundle:nil];
            userprofile.title=@"My Profile";
            LogOut *logout=[[LogOut alloc]initWithNibName:@"LogOut" bundle:nil];
            logout.title=@"Sign Out";
            tab=[[UITabBarController alloc]init];
            tab.viewControllers=[NSArray arrayWithObjects:searchViewController,userprofile,logout, nil];
            [self presentModalViewController:tab animated:NO];


}

But I couldnot see the tabbarcontroller added in fBLogin.I can see an empty white view.

Y is it so ?
how can I achieve it ?

  • 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-16T04:51:50+00:00Added an answer on June 16, 2026 at 4:51 am

    just set and initialize the UITabBarController in AppDelegate and when you sign in successfull just call UITabBarController as a rootViewController of window with our custom method For Ex…

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
        {
               UIViewController *viewController1 = [[[yourViewController1 alloc] initWithNibName:@"yourViewController1" bundle:nil] autorelease];
                UINavigationController *navviewController1=[[UINavigationController alloc]initWithRootViewController:viewController1];
    
    
                UIViewController *viewController2 = [[[yourViewController2 alloc] initWithNibName:@"yourViewController2" bundle:nil] autorelease];
                UINavigationController *navviewController2=[[UINavigationController alloc]initWithRootViewController:viewController2];
    
    
                UIViewController *viewController3 = [[[yourViewController3 alloc] initWithNibName:@"yourViewController3" bundle:nil] autorelease];
                UINavigationController *navviewController3=[[UINavigationController alloc]initWithRootViewController:viewController3];
    
    
                UIViewController *viewController4 = [[[yourViewController4 alloc] initWithNibName:@"yourViewController4" bundle:nil] autorelease];
                UINavigationController *navviewController4=[[UINavigationController alloc]initWithRootViewController:viewController4];
    
    
                UIViewController *viewController5 = [[[yourViewController5 alloc] initWithNibName:@"yourViewController5" bundle:nil] autorelease];
                UINavigationController *navviewController5=[[UINavigationController alloc]initWithRootViewController:viewController5];
    
    
                self.tabBarController = [[[UITabBarController alloc] init] autorelease];
                self.tabBarController.viewControllers = [NSArray arrayWithObjects:navviewController1, navviewController2,navviewController3,navviewController4,navviewController5, nil];
    
            SearchView *first=[[SearchView alloc]
                                initWithNibName:@"SearchView" bundle:nil];
    
    
            Login *second=[[Login alloc]initWithNibName:@"Login" bundle:nil];
            second.title=@"Login";
            NSArray *viewArray=[[NSArray alloc] initWithObjects: first,second,nil];
            yourTabBarController=[[UITabBarController alloc] init];
            [yourTabBarController setViewControllers:viewArray animated:NO];
            [self.window addSubview:yourTabBarController.view];
    
            [self.window makeKeyAndVisible];
            return YES;
        }
    

    when you sign in success full just call bellow our custom method..

    -(void)loadTabBarFromDelegate 
    {
        self.window.rootViewController = self.tabBarController;
        [self.window makeKeyAndVisible];
    
        CATransition *animation = [CATransition animation];
        [animation setDelegate:self];   
        [animation setType:kCATransitionFade];
        [animation setDuration:0.5];
        [animation setTimingFunction:[CAMediaTimingFunction functionWithName:
                                      kCAMediaTimingFunctionEaseInEaseOut]];
        [[self.window layer] addAnimation:animation forKey:@"transitionViewAnimation"];
    }
    

    and when you want to call this method just create object and call this method like bellow…

    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    [appDelegate loadTabBarFromDelegate];
    

    i hope this help you…

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

Sidebar

Related Questions

Hї! I have wrote test for my application. I need add item to database
Need to add two same name .csproj class libraries in my solution.Have two project
I am writing an application where you need to show login screen modally and
I need add some files in my application and this files must be unpacked
I have small requirement: I need add image over(up) the another image through javascript.
I Need add custom values to AppSettings in a webservice i have this code,
I need add string starts with @ in android resources, but take error: No
I need a login viewcontroller,when log in,entry the tabbar controller,and the view in tabbarcontroller
I'm having trouble in my Android application. I need add LinearLayouts inside another linearlayout.
My application is a Tabbed Application, and it have several controllers under the tabBarController.

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.