📅  最后修改于: 2022-03-11 15:01:03.380000             🧑  作者: Mango
// Make sure you also add the scrollEdgeAppearance in >iOS15!
let backgroundColor = .yellow
let tintColor = .white
if #available(iOS 13.0, *) {
let navBarAppearance = UINavigationBarAppearance()
navBarAppearance.configureWithDefaultBackground()
navBarAppearance.backgroundColor = .clear
navBarAppearance.backgroundImage = UIImage(color: backgroundColor)
navBarAppearance.shadowColor = nil
self.navigationBar.standardAppearance = navBarAppearance
self.navigationBar.compactAppearance = navBarAppearance
// Important to add:
self.navigationBar.scrollEdgeAppearance = navBarAppearance
}