Ios 更改自定义UINavigationBar属性无法完全正常工作

Ios 更改自定义UINavigationBar属性无法完全正常工作,ios,swift,uinavigationbar,uinavigationitem,Ios,Swift,Uinavigationbar,Uinavigationitem,我正在更改自定义导航栏的默认导航栏,以设置自定义本地化标题,但我无法像通常那样更改标题颜色或“后退”按钮。你能看出我做错了什么吗? 像往常一样非常感谢 navigationBar.setBackgroundImage(UIImage(), for: .default) navigationBar.shadowImage = UIImage() navigationBar.backgroundColor = .clear navigationBar.backItem?.leftBarButtonI

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

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

您需要更改
navigationBar.barTintColor
navigationBar.tintColor
首先欢迎来到这个伟大的社区。第二,谢谢。我以前确实试过这个,但我一定是打错了。它现在可以正常工作了。