File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
iOS/DoraemonKit/Src/Core/Plugin/ViewMetrics/Function Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,16 @@ - (void)setEnable:(BOOL)enable
45
45
[window hideDoraemonMetricsRecursive ];
46
46
}
47
47
}
48
+
49
+ // 每当状态栏发生变化(如: 时间跳动,4G切WIFI,横竖屏切换等),状态栏会走`layoutSubviews`方法,会导致状态栏也出现元素边框;而[UIApplication sharedApplication].windows数组内拿不到UIStatusBarWindow,关闭元素边框无法及时隐藏状态栏的边框线
50
+ // 也可以在`UIView+DoraemonViewMetrics.h`内的`shouldShowMetricsView`中直接禁掉状态栏的元素边框
51
+ NSString *statusBarString = [NSString stringWithFormat: @" _statusBarWindow" ];
52
+ UIWindow *statusBarWindow = [[UIApplication sharedApplication ] valueForKey: statusBarString];
53
+ if (statusBarWindow) {
54
+ if (!enable) {
55
+ [statusBarWindow hideDoraemonMetricsRecursive ];
56
+ }
57
+ }
48
58
}
49
59
50
60
@end
Original file line number Diff line number Diff line change @@ -32,6 +32,13 @@ - (BOOL)shouldShowMetricsView
32
32
return NO ;
33
33
}
34
34
35
+ // 状态栏不需要显示元素边框
36
+ NSString *statusBarString = [NSString stringWithFormat: @" _statusBarWindow" ];
37
+ UIWindow *statusBarWindow = [[UIApplication sharedApplication ] valueForKey: statusBarString];
38
+ if (statusBarWindow && [self isDescendantOfView: statusBarWindow]) {
39
+ return NO ;
40
+ }
41
+
35
42
if ([self isInBlackList ]) {
36
43
return NO ;
37
44
}
You can’t perform that action at this time.
0 commit comments