ios - 更改自定义 UINavigationBar 属性不能完全快速工作

标签 ios swift uinavigationbar uinavigationitem

我正在更改自定义 navigationBar 的默认导航栏,以设置自定义本地化标题,但我无法像往常一样更改它的标题颜色和后退按钮。你能看出我做错了什么吗? 像往常一样非常感谢

navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationBar.shadowImage = UIImage()
navigationBar.backgroundColor = .clear
navigationBar.backItem?.leftBarButtonItem?.tintColor =  Theme.secondTintColor // not working
navigationItem.title = NSLocalizedString("Route Checkings VC Title", comment: "")
navigationItem.titleView?.tintColor = Theme.secondTintColor // not working
navigationItem.rightBarButtonItem?.tintColor = Theme.firstTintColor
navigationItem.leftBarButtonItem?.tintColor = Theme.secondTintColor // not working

最佳答案

试试这个

    navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
    navigationController?.navigationBar.tintColor = UIColor.white

关于ios - 更改自定义 UINavigationBar 属性不能完全快速工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58763315/

相关文章:

swift - 在不考虑泛型类型约束的情况下检查泛型类的类型

iphone - 设置自定义 UINavigationBar

swift - 当 UISearchController 聚焦时重置 UIView

iphone - UINavigationBar 右键选择

javascript - iOS NSDictionary 数据类型到 phonegap 中的 javascript。如何?

ios - 来自外部源的 iframe 内容未加载到 iOS 上的本地 HTML 文件中

iOS 不可靠位置权限警报

swift - 表格 View 单元格中的更改图像按钮

ios - 如何从 iTunesConnect/App Store Connect 中删除应用程序

android - Adobe Flex 如何在 Android/iOS 上运行