修改了iOS15下导航栏变成透明的颜色 以及导航栏下面的黑色的线条

This commit is contained in:
fengshuo
2021-11-30 18:18:12 +08:00
committed by zu
parent e552c39856
commit 38d0b15799
4 changed files with 26 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 313 B

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 558 B

After

Width:  |  Height:  |  Size: 350 B

View File

@@ -40,6 +40,17 @@
NSFontAttributeName:[UIFont systemFontOfSize:18 weight:UIFontWeightMedium],
NSForegroundColorAttributeName:UIColor.whiteColor
}];
/// scrollEdgeAppearance iOS15 nil 使 standardAppearance使 @fengshuo
if (@available(iOS 15.0, *)) {
UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
appearance.titleTextAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:18 weight:UIFontWeightMedium],
NSForegroundColorAttributeName:UIColor.whiteColor};
appearance.backgroundColor = [ThemeColor appBackgroundColor];
self.navigationBar.standardAppearance = appearance;
self.navigationBar.scrollEdgeAppearance = appearance;
}
}
@end

View File

@@ -20,8 +20,22 @@
[super viewWillAppear:animated];
//
[self.navigationController setNavigationBarHidden:self.isHiddenNavBar animated:animated];
///iOS15 线 @fengshuo
if (@available(iOS 15.0, *)) {
[self.navigationController.navigationBar.subviews enumerateObjectsUsingBlock:^(UIView *view, NSUInteger idx, BOOL *stop) {
if ([[UIDevice currentDevice].systemVersion doubleValue] >= 10.0) {
//iOS10,_UIBarBackground
if ([view isKindOfClass:NSClassFromString(@"_UIBarBackground")]) {
[view.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:NSClassFromString(@"_UIBarBackgroundShadowView")]) {
obj.hidden = YES;
}
}];
}
}
}];
}
}
- (void)viewDidLoad {
[super viewDidLoad];
[self themeConfig];