Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had worked on almost the same case, actually used the code from <a href="http://www.developers-life.com/hide-uitabbarcontrolleruitabbar-with-animation.html" rel="nofollow">http://www.developers-life.com/hide-uitabbarcontrolleruitabbar-with-animation.html</a> and made it better according to my needs, this might help others too.</p> <p>I am using a UISplitViewController as the root view controller and its detail portion is a UITabBarController, I had to hide the tabbar in portrait mode:</p> <pre><code>// In UITabBarController's custom implementation add following method, // this method is all that will do the trick, just call this method // whenever tabbar needs to be hidden/shown - (void) hidetabbar:(NSNumber*)isHidden { UITabBarController *tabBarController=self; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; CGRect tabbarFrame=CGRectZero; for(UIView *theView in tabBarController.view.subviews) { //NSLog(@"%@", view); if([theView isKindOfClass:[UITabBar class]]) { tabbarFrame=theView.frame; if ([isHidden boolValue]) { tabbarFrame=CGRectMake(tabbarFrame.origin.x, tabBarController.view.frame.size.height, tabbarFrame.size.width, tabbarFrame.size.height); } else { tabbarFrame=CGRectMake(tabbarFrame.origin.x, tabBarController.view.frame.size.height - tabbarFrame.size.height, tabbarFrame.size.width, tabbarFrame.size.height); } theView.frame=tabbarFrame; break; } } for(UIView *theView in tabBarController.view.subviews) { if(![theView isKindOfClass:[UITabBar class]]) { CGRect theViewFrame=theView.frame; if ([isHidden boolValue]) { theViewFrame=CGRectMake(theViewFrame.origin.x, theViewFrame.origin.y, theViewFrame.size.width, theViewFrame.size.height + tabbarFrame.size.height); } else { theViewFrame=CGRectMake(theViewFrame.origin.x, theViewFrame.origin.y, theViewFrame.size.width, theViewFrame.size.height - tabbarFrame.size.height); } theView.frame=theViewFrame; } } [UIView commitAnimations]; } </code></pre> <p>I used following code to call the hidetabbar: method </p> <pre><code>//In my UISplitViewController's custom implementation - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { @synchronized(self){ //change the self.splitDetailController to your UITabBarController's object [self.splitDetailController performSelector:@selector(hidetabbar:) withObject:[NSNumber numberWithBool:UIInterfaceOrientationIsLandscape(interfaceOrientation)] afterDelay:0.5]; } return YES; } </code></pre> <p>I tested this code to work in simulator only, let me know if it works on device too ;-)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload