if(@available(iOS13.0, *)) {
//设置导航颜色
UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
[appearance configureWithOpaqueBackground];
appearance.backgroundColor = [UIColor redColor];
//设置标题字体颜色
[appearance setTitleTextAttributes:
@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont boldSystemFontOfSize:16]}];
//去掉导航栏线条
appearance.shadowColor= [UIColor clearColor];
self.navigationBar.standardAppearance = appearance;
self.navigationBar.scrollEdgeAppearance = self.navigationBar.standardAppearance;
}
见下图: