更改自定义 UINavigationBar 属性无法完全正常工作 swift
Changing custom UINavigationBar attributes not working completely swift
我正在更改自定义 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
我正在更改自定义 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