Hide UITabBarController/UITabBar with animation.
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
BOOL hiddenTabBar;
UITabBarController *tabBarController; - (void) hideTabBar { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.4]; for(UIView *view in tabBarController.view.subviews) { CGRect _rect = view.frame; if([view isKindOfClass:[UITabBar class]]) { if (hiddenTabBar) { _rect.origin.y = 431; [view setFrame:_rect]; } else { _rect.origin.y = 480; [view setFrame:_rect]; } } else { if (hiddenTabBar) { _rect.size.height = 431; [view setFrame:_rect]; } else { _rect.size.height = 480; [view setFrame:_rect]; } } } [UIView commitAnimations]; hiddenTabBar = !hiddenTabBar; } |
Comments are closed.