Für iOS 13+
Der Trick besteht darin, 'UINavigationBarAppearance'
mit TransparentBackground
zu initialisieren. Dann können Sie ganz einfach die horizontale Linie der Navigationsleiste entfernen.
let appearance = UINavigationBarAppearance()
appearance.configureWithTransparentBackground()
appearance.backgroundColor = .green // Erforderliche Hintergrundfarbe
Fügen Sie schließlich die Erscheinungsänderungen zum Navigationspunkt hinzu, wie von Apple vorgeschlagen.
self.navigationItem.standardAppearance = appearance
self.navigationItem.scrollEdgeAppearance = appearance
self.navigationItem.compactAppearance = appearance