Swift 修改navigationBar 的黑色背景更换颜色

2022-04-20  本文已影响0人  ZM_微笑向阳
   if #available(iOS 13.0, *) {
        let appearance = UINavigationBarAppearance()
        appearance.configureWithOpaqueBackground()
         appearance.backgroundColor =  MyColor.MColor
         //设置取消按钮的字
        appearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
        navigationBar.standardAppearance = appearance
        navigationBar.scrollEdgeAppearance = navigationBar.standardAppearance
    } else {
        UINavigationBar.appearance().barTintColor = MyColor.TTextColor
        UINavigationBar.appearance().titleTextAttributes = [.foregroundColor: UIColor.white]
        UINavigationBar.appearance().tintColor = .white
    }
上一篇 下一篇

猜你喜欢

热点阅读