skip to Main Content

Today I just updated my Xcode to version 13 and found that all the navigation bars and the tab bars of my project turned black, I didn’t change any settings, my project was working fine on Xcode 12, and I have toggled it to light mode, I couldn’t find a way to recover the appearances to the old ones.enter image description here

enter image description here

3

Answers


  1. Apply the following code to update the appearance of the navigation bar. This can be done in AppDelegate if you wish for it to be the appearance throughout the app.

    let appearance = UINavigationBarAppearance()
    appearance.configureWithOpaqueBackground()
    appearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: .black]
    appearance.backgroundColor = .white
    // Default portrait view
    UINavigationBar.appearance().standardAppearance = appearance
    // There are other appearances you could apply it to as well...
    // UINavigationBar.appearance().scrollEdgeAppearance = appearance
    // UINavigationBar.appearance().compactAppearance = appearance
    
    Login or Signup to reply.
  2. Make like this:

    let appearance = UINavigationBarAppearance()
    appearance.configureWithOpaqueBackground()
    appearance.backgroundColor = .red
    appearance.titleTextAttributes = [.font: 
    UIFont.boldSystemFont(ofSize: 20.0),
                                  .foregroundColor: UIColor.white]
    
    // Customizing our navigation bar
    navigationController?.navigationBar.tintColor = .white
    navigationController?.navigationBar.standardAppearance = appearance
    navigationController?.navigationBar.scrollEdgeAppearance = appearance
    

    I wrote a new article talking about it.

    https://medium.com/@eduardosanti/uinavigationbar-is-black-on-ios-15-44e7852ea6f7

    Login or Signup to reply.
  3. Just simply check the "Translucent" in your attributes inspector.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search