Friday 15 March 2013

Code to Hide tab Bar


//Calling method
[self hideTabBar:self.tabBarController];
[self  showTabBar:self.tabBarController];




//To Hide Tab Bar
- (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.x480, view.frame.size.width, view.frame.size.height)];
            } 
            else 
            {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width480)];
            }
            
        }
        
        [UIView commitAnimations];
        
        
        
     
    }
    

//To Show Tab Bar
    - (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.x431, view.frame.size.width, view.frame.size.height)];
                
            } 
            else 
            {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width431)];
            }
            
            
        }
        
        [UIView commitAnimations]; 
    }

No comments:

Post a Comment