问题
升级到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;//重新赋值
}
网友评论