//**************************【动画】**************************//
+ (void)tabBarAnimation:(AnimationsType)type Hidden:(BOOL)hidden{
switch (type) {
case AnimationDefaule:
tabBarController.tabBar.hidden = hidden;
break;
case AnimationDown:
[YasinTabBarController downAnimation:hidden];
break;
case AnimationTabBarAndNav:
[YasinTabBarController tabBarAndNavAnimation:hidden];
break;
default:
break;
}
}
+ (void)downAnimation:(BOOL)flag{
if (!flag) {
tabBarController.tabBar.hidden = NO;
}
[UIView animateWithDuration:0.3 animations:^{
CGRect tabFrame = tabBarController.tabBar.frame;
if (flag) {
tabFrame.origin.y = Bound_Height;
}else{
tabFrame.origin.y = Bound_Height - tabFrame.size.height;
}
tabBarController.tabBar.frame = tabFrame;
} completion:^(BOOL finished) {
tabBarController.tabBar.hidden = flag;
}];
}
+ (void)tabBarAndNavAnimation:(BOOL)flag
{
id vc = tabBarController.viewControllers[selectIndex];
if ([vc isKindOfClass:[UINavigationController class]]) {
UINavigationController *nav = (UINavigationController *)vc;
[nav setNavigationBarHidden:flag animated:YES];
}
if (!flag) {
tabBarController.tabBar.hidden = NO;
}
[UIView animateWithDuration:UINavigationControllerHideShowBarDuration animations:^{
CGRect tabFrame = tabBarController.tabBar.frame;
if (flag) {
tabFrame.origin.y = Bound_Height;
}else{
tabFrame.origin.y = Bound_Height - tabFrame.size.height;
}
tabBarController.tabBar.frame = tabFrame;
} completion:^(BOOL finished) {
tabBarController.tabBar.hidden = flag;
}];
}
#pragma mark UITabBarControllerDelegate
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
selectIndex = tabBarController.selectedIndex;
// tabBarController.selectedIndex
}