0

i am having one problem in iOS project,i need to hide my tab bars during login function and like to show my tab bars after login.I have searched many contents no one is working for my project.Please give me the solution with detailed procedure like where and what i want to develop .in my project app delegate function has

 tabView = [[GTabBar alloc]initWithTabViewControllers:viewControllersArraytabItems:tabItemsArray initialTab:1]; 
    [window    addSubview:tabView.view]; 
    [window makeKeyAndVisible];
  • GTabBar ->for creating Tab Bar.
  • viewcontroller array ->list of view controllers.
  • tabitems array->list of tab items.
  • apart from that MainViewController is a file for handling tab events.

    Thanks in advance

Bug
  • 2,576
  • 2
  • 21
  • 36
Uday
  • 21
  • 10

3 Answers3

0

You can create one navigation controller and then you can create your tabbar controller and push into the same navigation controller in which loginviewcontroller has.

you can achieve that via below steps:

  1. create login view controller
  2. create navigation controller with login as root controller
  3. when login process completes you just need to push whole tabbarcontroller in to the same navigation controller.
Piyush Hirpara
  • 1,279
  • 1
  • 11
  • 29
0

Add below methods in appdel and you can call this methods in any view controller to show and hide tabbbar. Just call this method wherever you want to show and hide tabBar.

- (void)hideTabBar:(UITabBarController *) tabbarcontroller
{
//    [UIView beginAnimations:nil context:NULL];
//    [UIView setAnimationDuration:0.1];

    for(UIView *view in tabbarcontroller.view.subviews)
    {
        if([view isKindOfClass:[UITabBar class]])
        {
            [view setFrame:CGRectMake(view.frame.origin.x, ([UIScreen mainScreen].bounds.size.height == 568.0 ? 568:480)+20, view.frame.size.width, view.frame.size.height)];
        }
        else
        {
            [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width,  [UIScreen mainScreen].bounds.size.height == 568.0 ?568: 480)];
        }
    }

//    [UIView commitAnimations];
}

- (void)showTabBar:(UITabBarController *) tabbarcontroller
{

    for(UIView *view in tabbarcontroller.view.subviews)
    {
        if([view isKindOfClass:[UITabBar class]])
        {
            [view setFrame:CGRectMake(view.frame.origin.x,  ([UIScreen mainScreen].bounds.size.height == 568.0 ? 519:431), view.frame.size.width, view.frame.size.height)];
        }
        else
        {
            [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width,  [UIScreen mainScreen].bounds.size.height == 568.0 ? 519:431)];
        }
    }
 //    [UIView commitAnimations];
}
Pradhyuman sinh
  • 3,936
  • 1
  • 23
  • 38
0

Login should become another workflow outside your main flow. So you should use tabbarController as main controller and login flow will be shown by presentation control

[tabbarController presentModalViewController:loginController animated:YES];
natvnn
  • 41
  • 2