|
@@ -4,12 +4,6 @@
|
4
|
4
|
|
5
|
5
|
const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
|
6
|
6
|
|
7
|
|
-@interface RNNNavigationController()
|
8
|
|
-
|
9
|
|
-@property (nonatomic, strong) NSMutableDictionary* originalTopBarImages;
|
10
|
|
-
|
11
|
|
-@end
|
12
|
|
-
|
13
|
7
|
@implementation RNNNavigationController
|
14
|
8
|
|
15
|
9
|
- (void)viewDidLayoutSubviews {
|
|
@@ -22,7 +16,7 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
|
22
|
16
|
}
|
23
|
17
|
|
24
|
18
|
- (CGFloat)getTopBarHeight {
|
25
|
|
- return self.navigationBar.frame.size.height;
|
|
19
|
+ return self.navigationBar.frame.size.height;
|
26
|
20
|
}
|
27
|
21
|
|
28
|
22
|
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
|
|
@@ -63,7 +57,6 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
|
63
|
57
|
|
64
|
58
|
if (bgColorAlpha == 0.0) {
|
65
|
59
|
if (![self.navigationBar viewWithTag:TOP_BAR_TRANSPARENT_TAG]){
|
66
|
|
- [self storeOriginalTopBarImages:self];
|
67
|
60
|
UIView *transparentView = [[UIView alloc] initWithFrame:CGRectZero];
|
68
|
61
|
transparentView.backgroundColor = [UIColor clearColor];
|
69
|
62
|
transparentView.tag = TOP_BAR_TRANSPARENT_TAG;
|
|
@@ -78,36 +71,16 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
|
78
|
71
|
UIView *transparentView = [self.navigationBar viewWithTag:TOP_BAR_TRANSPARENT_TAG];
|
79
|
72
|
if (transparentView){
|
80
|
73
|
[transparentView removeFromSuperview];
|
81
|
|
- [self.navigationBar setBackgroundImage:self.originalTopBarImages[@"backgroundImage"] forBarMetrics:UIBarMetricsDefault];
|
82
|
|
- self.navigationBar.shadowImage = self.originalTopBarImages[@"shadowImage"];
|
83
|
|
- self.originalTopBarImages = nil;
|
84
|
74
|
}
|
85
|
75
|
}
|
86
|
76
|
} else {
|
87
|
77
|
UIView *transparentView = [self.navigationBar viewWithTag:TOP_BAR_TRANSPARENT_TAG];
|
88
|
78
|
if (transparentView){
|
89
|
79
|
[transparentView removeFromSuperview];
|
90
|
|
- [self.navigationBar setBackgroundImage:self.originalTopBarImages[@"backgroundImage"] ? self.originalTopBarImages[@"backgroundImage"] : [self.navigationBar backgroundImageForBarMetrics:UIBarMetricsDefault] forBarMetrics:UIBarMetricsDefault];
|
91
|
|
- self.navigationBar.shadowImage = self.originalTopBarImages[@"shadowImage"] ? self.originalTopBarImages[@"shadowImage"] : self.navigationBar.shadowImage;
|
92
|
|
- self.originalTopBarImages = nil;
|
93
|
80
|
}
|
94
|
81
|
|
95
|
82
|
self.navigationBar.barTintColor = nil;
|
96
|
83
|
}
|
97
|
84
|
}
|
98
|
85
|
|
99
|
|
-- (void)storeOriginalTopBarImages:(UINavigationController *)navigationController {
|
100
|
|
- NSMutableDictionary *originalTopBarImages = [@{} mutableCopy];
|
101
|
|
- UIImage *bgImage = [navigationController.navigationBar backgroundImageForBarMetrics:UIBarMetricsDefault];
|
102
|
|
- if (bgImage != nil) {
|
103
|
|
- originalTopBarImages[@"backgroundImage"] = bgImage;
|
104
|
|
- }
|
105
|
|
- UIImage *shadowImage = navigationController.navigationBar.shadowImage;
|
106
|
|
- if (shadowImage != nil) {
|
107
|
|
- originalTopBarImages[@"shadowImage"] = shadowImage;
|
108
|
|
- }
|
109
|
|
- self.originalTopBarImages = originalTopBarImages;
|
110
|
|
-}
|
111
|
|
-
|
112
|
|
-
|
113
|
86
|
@end
|