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
}
网友评论