简体   繁体   中英

Large titles navigation bar black on iOS13/Xcode 11

since I updated Xcode to version 11/my device to iOS 13 my navigation bar background color changed to black when using large titles: large titles

The curious thing is that this does not happen with regular titles: regular titles

I already forced light mode (as I did not updated my assets for dark mode yet) and checked all the interface options available. When setting the navigation bar background color to white, the status bar still stays black - what am I doing wrong here? settings

Thanks in advance for your help.

In iOS 13 and later, a large title navigation bar doesn't include a background material or shadow by default. Also, a large title transitions to a standard title as people begin scrolling the content

if #available(iOS 13.0, *) {
    let appearance = UINavigationBarAppearance()
    appearance.backgroundColor = .purple
    appearance.titleTextAttributes = [.foregroundColor: UIColor.white]
    appearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white]

    UINavigationBar.appearance().tintColor = .white
    UINavigationBar.appearance().standardAppearance = appearance
    UINavigationBar.appearance().compactAppearance = appearance
    UINavigationBar.appearance().scrollEdgeAppearance = appearance
} else {
    UINavigationBar.appearance().tintColor = .white
    UINavigationBar.appearance().barTintColor = .purple
    UINavigationBar.appearance().isTranslucent = false
}

Also you can refer below solution

In iOS13 the status bar background colour is different from the navigation bar in large text mode

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM