1、iOS15.0+ 当在有导航栏界面push到导航栏隐藏界面时 push时会出现部分阴影及横线此时需要设置如下
if (@available(iOS 15.0, *)) {
UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
[appearance configureWithTransparentBackground];// 去除横线
appearance.backgroundColor = Underline;// 导航栏背景色
appearance.titleTextAttributes = @{NSForegroundColorAttributeName:HexCOLOR(0xffffff)};
[[UINavigationBar appearance] setScrollEdgeAppearance: appearance];
}else{
self.navigationController.navigationBar.titleTextAttributes= @{NSForegroundColorAttributeName:HexCOLOR(0xffffff),
NSFontAttributeName:FONT(18)}; //导航栏标题设置
}
2、导航栏字体颜色跟系统选择的模式有关系
当系统选择浅色则导航栏字体为黑色 系统选择深色导航栏字体则为白色,因此我们默认写好为深色模式(因为我这边的导航栏的title统一都设置为白色)
if (@available(iOS 13.0, *)) {
self.navigationController.navigationBar.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
}