Skip to content

Instantly share code, notes, and snippets.

@akuraru
Created July 14, 2014 04:00
Show Gist options
  • Save akuraru/b275770e00743650d675 to your computer and use it in GitHub Desktop.
Save akuraru/b275770e00743650d675 to your computer and use it in GitHub Desktop.
@implementation HideTabBar
+ (void)tabBarHidden:(BOOL)hide tabBar:(UITabBarController *)tabBarController {
CGFloat viewHeight = [self viewHeight:hide];
for (UIView *view in tabBarController.view.subviews) {
CGRect _rect = view.frame;
if ([view isKindOfClass:[UITabBar class]]) {
_rect.origin.y = viewHeight;
} else {
_rect.size.height = viewHeight;
}
[view setFrame:_rect];
}
}
+ (CGFloat)viewHeight:(BOOL)b {
return ([[UIScreen mainScreen] bounds].size.height - ((b) ? 0 : 49));
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment