@@ -28,51 +28,54 @@ - (void)setTabBarHideShadow:(BOOL)hideShadow {
2828 self.tabBar .clipsToBounds = hideShadow;
2929}
3030
31- - (void )setTabBarVisible : (BOOL )visible animated : (BOOL )animated {
32- const CGRect tabBarFrame = self.tabBar .frame ;
33- const CGRect tabBarVisibleFrame = CGRectMake (tabBarFrame.origin .x ,
34- self.view .frame .size .height - tabBarFrame.size .height ,
35- tabBarFrame.size .width ,
36- tabBarFrame.size .height );
37- const CGRect tabBarHiddenFrame = CGRectMake (tabBarFrame.origin .x ,
38- self.view .frame .size .height ,
39- tabBarFrame.size .width ,
40- tabBarFrame.size .height );
41- if (!animated) {
42- self.tabBar .hidden = !visible;
43- self.tabBar .frame = visible ? tabBarVisibleFrame : tabBarHiddenFrame;
44- return ;
45- }
46- static const CGFloat animationDuration = 0.15 ;
31+ - (void )centerTabItems {
32+ [self .tabBar centerTabItems ];
33+ }
34+
4735
48- if (visible) {
49- self.tabBar .hidden = NO ;
50- [UIView animateWithDuration: animationDuration
51- delay: 0
52- options: UIViewAnimationOptionCurveEaseOut
53- animations: ^()
54- {
55- self.tabBar .frame = tabBarVisibleFrame;
56- }
57- completion: ^(BOOL finished)
58- {}];
59- } else {
60- [UIView animateWithDuration: animationDuration
61- delay: 0
62- options: UIViewAnimationOptionCurveEaseIn
63- animations: ^()
64- {
65- self.tabBar .frame = tabBarHiddenFrame;
66- }
67- completion: ^(BOOL finished)
68- {
69- self.tabBar .hidden = YES ;
70- }];
71- }
36+ - (void )showTabBar : (BOOL )animated {
37+ static const CGFloat animationDuration = 0.15 ;
38+ const CGRect tabBarVisibleFrame = CGRectMake (self.tabBar .frame .origin .x ,
39+ self.view .frame .size .height - self.tabBar .frame .size .height ,
40+ self.tabBar .frame .size .width ,
41+ self.tabBar .frame .size .height );
42+ self.tabBar .hidden = NO ;
43+ if (!animated) {
44+ self.tabBar .frame = tabBarVisibleFrame;
45+ } else {
46+ [UIView animateWithDuration: animationDuration
47+ delay: 0
48+ options: UIViewAnimationOptionCurveEaseOut
49+ animations: ^()
50+ {
51+ self.tabBar .frame = tabBarVisibleFrame;
52+ } completion: ^(BOOL finished)
53+ {}];
54+ }
7255}
7356
74- - (void )centerTabItems {
75- [self .tabBar centerTabItems ];
57+ - (void )hideTabBar : (BOOL )animated {
58+ static const CGFloat animationDuration = 0.15 ;
59+ const CGRect tabBarHiddenFrame = CGRectMake (self.tabBar .frame .origin .x ,
60+ self.view .frame .size .height ,
61+ self.tabBar .frame .size .width ,
62+ self.tabBar .frame .size .height );
63+
64+ if (!animated) {
65+ self.tabBar .frame = tabBarHiddenFrame;
66+ self.tabBar .hidden = YES ;
67+ } else {
68+ [UIView animateWithDuration: animationDuration
69+ delay: 0
70+ options: UIViewAnimationOptionCurveEaseOut
71+ animations: ^()
72+ {
73+ self.tabBar .frame = tabBarHiddenFrame;
74+ } completion: ^(BOOL finished)
75+ {
76+ self.tabBar .hidden = YES ;
77+ }];
78+ }
7679}
7780
7881- (void )forEachTab : (void (^)(UIView *, UIViewController * tabViewController, int tabIndex))performOnTab {
0 commit comments