Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unchanged barTintColor UINavigationBar on iOS 13.4

After upgrading Xcode to Version 11.4 (11E146) on iOS 13.4 barTintColor only changes through the storyboard. In the code, changes are ignored.

self.navigationController.navigationBar.barTintColor = UIColor.redColor;

Also a problem with the color of the title.

enter image description here

Fixed in Xcode 11.4.1: Fixed in Xcode 11.4.1

like image 202
AlessandroDP Avatar asked Mar 25 '20 10:03

AlessandroDP


1 Answers

I was having the same issue, what fixed it for me was this:

On the storyboard, for your Navigation Controller change the "Bar Tint" to its "Default" value, then on your code you can change it as you normally would.

    // For the navigation bar
    navigationController?.navigationBar.barTintColor = .red

    // For the title
    let attributes = [NSAttributedString.Key.foregroundColor: UIColor.white ]
    navigationController?.navigationBar.titleTextAttributes = attributes

enter image description here

I have the code in viewDidLoad()

enter image description here

Oddly enough for me, it also fixed the issue I was having with the "Status Bar".

like image 117
J Arango Avatar answered Nov 08 '22 20:11

J Arango