修改了iOS15下导航栏变成透明的颜色 以及导航栏下面的黑色的线条
This commit is contained in:
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 |
@@ -40,6 +40,17 @@
|
|||||||
NSFontAttributeName:[UIFont systemFontOfSize:18 weight:UIFontWeightMedium],
|
NSFontAttributeName:[UIFont systemFontOfSize:18 weight:UIFontWeightMedium],
|
||||||
NSForegroundColorAttributeName:UIColor.whiteColor
|
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
|
@end
|
||||||
|
@@ -20,8 +20,22 @@
|
|||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
// 根据子类属性重写判断是否隐藏导航栏
|
// 根据子类属性重写判断是否隐藏导航栏
|
||||||
[self.navigationController setNavigationBarHidden:self.isHiddenNavBar animated: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 {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
[self themeConfig];
|
[self themeConfig];
|
||||||
|
Reference in New Issue
Block a user