@@ -58,16 +58,37 @@ class TeadsViewController: UIViewController {
5858 navigationItem. titleView = imageView
5959
6060 navigationBar. tintColor = . white
61+
62+ if #available( iOS 15 , * ) {
63+ navigationBar. barStyle = . black
64+
65+ let appearance = navigationBar. standardAppearance
66+ appearance. backgroundImage = backgroundImage
67+ navigationBar. standardAppearance = appearance
68+ navigationBar. scrollEdgeAppearance = appearance
69+ navigationBar. compactAppearance = appearance
70+ }
6171 }
6272
6373 fileprivate func applyDefaultNavigationBar( ) {
64- navigationController? . navigationBar. setBackgroundImage ( UIImage ( ) , for: UIBarMetrics . default)
65- navigationController? . navigationBar. shadowImage = UIImage ( )
74+ guard let navigationBar = navigationController? . navigationBar else {
75+ return
76+ }
77+ navigationBar. setBackgroundImage ( UIImage ( ) , for: UIBarMetrics . default)
78+ navigationBar. shadowImage = UIImage ( )
6679 let imageView = UIImageView ( image: teadsLogo)
6780 imageView. contentMode = . scaleAspectFit
6881 imageView. translatesAutoresizingMaskIntoConstraints = false
6982 imageView. heightAnchor. constraint ( equalToConstant: 30 ) . isActive = true
7083 navigationItem. titleView = imageView
84+ if #available( iOS 15 , * ) {
85+ let appearance = navigationBar. standardAppearance
86+ appearance. backgroundImage = UIImage ( )
87+ appearance. shadowImage = UIImage ( )
88+ navigationBar. standardAppearance = appearance
89+ navigationBar. scrollEdgeAppearance = appearance
90+ navigationBar. compactAppearance = appearance
91+ }
92+
7193 }
72-
7394}
0 commit comments