|
@@ -31,8 +31,47 @@
|
31
|
31
|
self.tabBar.clipsToBounds = hideShadow;
|
32
|
32
|
}
|
33
|
33
|
|
34
|
|
-- (void)rnn_setTabBarVisible:(BOOL)visible {
|
35
|
|
- self.tabBar.hidden = !visible;
|
|
34
|
+- (void)rnn_setTabBarVisible:(BOOL)visible animated:(BOOL)animated {
|
|
35
|
+ const CGRect tabBarFrame = self.tabBar.frame;
|
|
36
|
+ const CGRect tabBarVisibleFrame = CGRectMake(tabBarFrame.origin.x,
|
|
37
|
+ self.view.frame.size.height - tabBarFrame.size.height,
|
|
38
|
+ tabBarFrame.size.width,
|
|
39
|
+ tabBarFrame.size.height);
|
|
40
|
+ const CGRect tabBarHiddenFrame = CGRectMake(tabBarFrame.origin.x,
|
|
41
|
+ self.view.frame.size.height,
|
|
42
|
+ tabBarFrame.size.width,
|
|
43
|
+ tabBarFrame.size.height);
|
|
44
|
+ if (!animated) {
|
|
45
|
+ self.tabBar.hidden = !visible;
|
|
46
|
+ self.tabBar.frame = visible ? tabBarVisibleFrame : tabBarHiddenFrame;
|
|
47
|
+ return;
|
|
48
|
+ }
|
|
49
|
+ static const CGFloat animationDuration = 0.15;
|
|
50
|
+
|
|
51
|
+ if (visible) {
|
|
52
|
+ self.tabBar.hidden = NO;
|
|
53
|
+ [UIView animateWithDuration: animationDuration
|
|
54
|
+ delay: 0
|
|
55
|
+ options: UIViewAnimationOptionCurveEaseOut
|
|
56
|
+ animations:^()
|
|
57
|
+ {
|
|
58
|
+ self.tabBar.frame = tabBarVisibleFrame;
|
|
59
|
+ }
|
|
60
|
+ completion:^(BOOL finished)
|
|
61
|
+ {}];
|
|
62
|
+ } else {
|
|
63
|
+ [UIView animateWithDuration: animationDuration
|
|
64
|
+ delay: 0
|
|
65
|
+ options: UIViewAnimationOptionCurveEaseIn
|
|
66
|
+ animations:^()
|
|
67
|
+ {
|
|
68
|
+ self.tabBar.frame = tabBarHiddenFrame;
|
|
69
|
+ }
|
|
70
|
+ completion:^(BOOL finished)
|
|
71
|
+ {
|
|
72
|
+ self.tabBar.hidden = YES;
|
|
73
|
+ }];
|
|
74
|
+ }
|
36
|
75
|
}
|
37
|
76
|
|
38
|
77
|
@end
|