美文网首页
Swift 修改navigationBar 的黑色背景更换颜色

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

作者: ZM_微笑向阳 | 来源:发表于2022-04-20 10:44 被阅读0次
   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
    }

相关文章

网友评论

      本文标题:Swift 修改navigationBar 的黑色背景更换颜色

      本文链接:https://www.haomeiwen.com/subject/vufvertx.html