barTintColor not working correctly for large titles iOS 13

I am currently using the following code to display the background color of the navigation bar, which has been working correctly for forever:


self.navigationController?.navigationBar.barTintColor


However, when I installed an existing live app (NOT compiled in Xcode 11 beta) from the app store on a device running public beta 13.1, it does not show the color until the view is scrolled and the navigationBar compacts. It starts out as just white (most likely transparent) and then on scroll when the navigation header goes from large titles to compact, the color all of a sudden shows up.


I have figured out a way around this for an app update but obviously I'm very concerned about the lack of backwards compatiblity since it makes the existing app look horrible. (We have white titles on a colored background in the header and since the navbar starts out as white/transparent, there is literally nothing showing in the header until scrolled.


Is this a bug that Apple has yet to work out? Surely they wouldn't push the new iOS out like that since I can't be the only one running into this.

Post not yet marked as solved Up vote post of kevint7 Down vote post of kevint7
13k views

Replies

I have the same problem using iOS 13.1 beta. I used this to workaround:


self.navigationController?.view.backgroundColor = bar tint


However, the app still looks really bad. The large title and the searchbar scrolls into the view when draging down the view.


Does anyone know how to fix this?

I found a workaround for iOS 12

when setting up tint color apply it to


if (@available(iOS 13, *)) {

[[UINavigationBar appearance] setBarTintColor:barTintColor];

}

I am having similar issue on iOS 13.1 beta 4.

Setting up navigationBar's background color fixes the issue for me. Not sure if this is a correct solution.


navigationController?.navigationBar.backgroundColor = /*tintcolor*/
  • this seems to solve the issue for me too!

  •     navBar.standardAppearance.backgroundColor = UIColor.systemYellow didn't work for me from RootNC a subclass of UINavigationController. The embedding NavigationControllers inside storyboards has RootNC as its custom class. I'm tried this in viewDidLoad. iOS 17.2 simulator.
    
  • I see it turn yellow only when i scroll-up the tableview below the navbar.

Add a Comment

This seems to have solved my problem. Thanks!

Thank you so much! This has helped me very much. However the top bar showing carrier signal and battery etc is still the wrong color. Do you know how to change this also?

I was facing the same issue.
Setting the navigation bar backgroundColor property instead of barTintColor worked for me.

Declaring

let navigationBarAppearace = UINavigationBar.appearance()

navigationBarAppearace.titleTextAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]

navigationBarAppearace.backgroundColor = UIColor.blue

did the trick. However, I'm now trying to change this area's color:

Check this link, https://medium.com/do-not-stop-running/to-solve-the-issue-of-changing-navigation-bars-bartint-color-but-not-covering-status-bar-s-color-e4cbc4887a77