@@ -58,16 +58,37 @@ class TeadsViewController: UIViewController {
58
58
navigationItem. titleView = imageView
59
59
60
60
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
+ }
61
71
}
62
72
63
73
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 ( )
66
79
let imageView = UIImageView ( image: teadsLogo)
67
80
imageView. contentMode = . scaleAspectFit
68
81
imageView. translatesAutoresizingMaskIntoConstraints = false
69
82
imageView. heightAnchor. constraint ( equalToConstant: 30 ) . isActive = true
70
83
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
+
71
93
}
72
-
73
94
}
0 commit comments