How to fix iOS 15 tab bar transparent after scrolling to the bottom:
The tab bar is meant to have a background until nothing is scrolled behind it. If the tab bar doesn’t respond to you scrolling away from the bottom by displaying its background, then we likely couldn’t find the scroll view (the default search makes a lot of assumptions for performance sake).
Inside Safari Settings, scroll down and enable the ‘Landscape Tab Bar’ toggle. This should enable the new Landscape Tab Bar UI inside the Safari app on iOS 15.
Generally, when you use the Safari app to browse websites on iOS 15 in landscape mode, you’ll be greeted by the Tab Bar at the top of the start bar or website that’s been loaded. In many ways, this Tab Bar will resemble that of the Tab Bar that appears when you hold the iPhone upright.
Scroll to or search for " Safari " 3. Scroll down to the subsection labeled " Tabs " 4. Switch from "Tab Bar" on the left to " Single Tab " on the right. 5. (Optional) Breathe a sigh of relief. Now things should feel a little more familiar.
In iOS 15, UIKit has extended the usage of the scrollEdgeAppearance, which by default produces a transparent background.
Since I changed the tab bar color globally in my app, prior to iOS 15, I have added the following code to my AppDelegate:
UITabBar.appearance().barTintColor = "YOUR UITABBAR COLOR"
UITabBar.appearance().tintColor = "YOUR ICONS COLOR"
UITabBar.appearance().isTranslucent = true
To restore the old look, I had adopt the new UITBar appearance APIs, UITabBarAppearance. I changed my code to:
UITabBar.appearance().barTintColor = "YOUR UITABBAR COLOR"
UITabBar.appearance().tintColor = "YOUR ICONS COLOR"
UITabBar.appearance().isTranslucent = true
if #available(iOS 15.0, *) {
let appearance = UITabBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = "YOUR UITABBAR COLOR"
UITabBar.appearance().standardAppearance = appearance
UITabBar.appearance().scrollEdgeAppearance = UITabBar.appearance().standardAppearance
}
As a result, I get the original color of my UITabBar
With iOS 15, Apple adds the scrollEdgeAppearance
property for configuring the appearance of the tab bar while edge scrolling.
https://developer.apple.com/documentation/uikit/uitabbar/3750912-scrolledgeappearance?changes=latest_minor
To fix the transparent tab bar, you should create a custom scroll edge appearance and set it to the tab bar.
if #available(iOS 15.0, *) {
let appearance = UITabBarAppearance()
appearance.backgroundEffect = UIBlurEffect(style: .light)
tabBar.scrollEdgeAppearance = appearance
}
Result:
init() {
if #available(iOS 15, *) {
let tabBarAppearance: UITabBarAppearance = UITabBarAppearance()
tabBarAppearance.configureWithOpaqueBackground()
UITabBar.appearance().standardAppearance = tabBarAppearance
UITabBar.appearance().scrollEdgeAppearance = tabBarAppearance
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With