Hide tap bar

Discussion in 'iOS Programming' started by joak, Apr 2, 2014.

  1. joak macrumors newbie

    Joined:
    Mar 7, 2014
    #1
    Hi

    How you can see at file attached ... I have two UIviewControllers, "Cedula Arbitral - Partidos has a TableView object, when the user tap on a row, show it the last UIViewController (all black) with this code on didSelectRowAtIndexPath
    Code:
    [self.navigationController pushViewController:tablero animated:YES];
    
    It's possible to hide the tap bar on the last UIVieController?
     

    Attached Files:

    • hoy.png
      hoy.png
      File size:
      33.1 KB
      Views:
      61
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
  3. joak thread starter macrumors newbie

    Joined:
    Mar 7, 2014
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
  5. joak thread starter macrumors newbie

    Joined:
    Mar 7, 2014
  6. PBG4 Dude macrumors 68000

    PBG4 Dude

    Joined:
    Jul 6, 2007
    #6
    Have you tried a modal segue instead of push?

    If you aren't using storyboards this could be even easier.
     
  7. waterskier2007 macrumors 68000

    waterskier2007

    Joined:
    Jun 19, 2007
    Location:
    White Lake, MI
    #7
    Isn't there an option in the storyboard to "Hide bottom bar when pushed"

    I believe it corresponds to

    Code:
    @property(nonatomic) BOOL hidesBottomBarWhenPushed
    
    which is a property of UIViewController. Not sure if this applies to the tab bar because the documentation states it is used to hide a toolbar, but you might give it a shot.
     
  8. joak thread starter macrumors newbie

    Joined:
    Mar 7, 2014
    #8
    I found two methods(hideTabBar-showTabBar).... only hideTabBar method works fine ..... showTabBar method doesn't work ... both method are on UIViewController child .... when the user tap on "Back" botton on Navigation bar, I trigger the showTabBar method

    Any ideas?

    Code:
    - (void)didMoveToParentViewController:(UIViewController *)parent
    {
        if (![parent isEqual:self.parentViewController]) {
            NSLog(@"Back pressed");
            [self showTabBar:self.tabBarController];
        }
    }
    

    Code:
    - (void)hideTabBar:(UITabBarController *) tabbarcontroller
    {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.5];
        
        for(UIView *view in tabbarcontroller.view.subviews)
        {
            if([view isKindOfClass:[UITabBar class]])
            {
                [view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width, view.frame.size.height)];
            }
            else
            {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)];
            }
        }
        
        [UIView commitAnimations];
    }
    
    
    - (void)showTabBar:(UITabBarController *) tabbarcontroller
    {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.5];
        for(UIView *view in tabbarcontroller.view.subviews)
        {
            NSLog(@"%@", view);
            
            if([view isKindOfClass:[UITabBar class]])
            {
                [view setFrame:CGRectMake(view.frame.origin.x, 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, 431)];
            }
        }
        
        [UIView commitAnimations];
    }
    
     

Share This Page