IOS15适配,导航栏设置,OC

2021-11-16  本文已影响0人  偷的浮生整日闲

问题

升级到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;//重新赋值
    }
上一篇下一篇

猜你喜欢

热点阅读