問題
升級到ios15之后,原來的barTintColor將不會生效
解決
if(@available(iOS 15.0,*)){
UINavigationBarAppearance *apperance=[[UINavigationBarAppearance alloc]init];
apperance.backgroundColor=[UIColor xxxColor];//設置背景色
[apperance setTitleTextAttributes:@{
NSFontAttributeName:[UIFont systemFontOfSize:18],
NSForegroundColorAttributeName:titleColor
}];//設置標題字體
apperance.shadowImage = [[UIImage alloc]init];
apperance.shadowColor=nil;//分割線去除
[UINavigationBar appearance].standardAppearance=apperance;
[UINavigationBar appearance].scrollEdgeAppearance=[UINavigationBar appearance].standardAppearance;//重新賦值
}