Vincenzo
Vincenzo

Reputation: 6408

Changing custom UINavigationBar attributes not working completely swift

I'm changing the default navigation bar for a custom navigationBar, to set a custom localised title but I'm not able to change it's title color nor the back button as I normally do. Can you see what I'm doing wrong? Many thanks as usual

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

Upvotes: 0

Views: 67

Answers (1)

Tony Gilbert
Tony Gilbert

Reputation: 111

Try this

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

Upvotes: 1

Related Questions