Reputation: 27
I'm working on a project that requires a Tabbar. Currently I have my code set up so that after login or sign up I'm presented by the Explore tab (The third tab). The goal I'm trying to achieve is to have my project only show a translucent tab bar background. When I was originally working on my project I had no issue doing this. I ran in the problem after I incorporated a table view that allow for scrolling. Currently when ever I push on the tab 1-4 I get a translucent background. When tab 5 (includes the table view with scrolling) is pressed the background of the tab bar changes to a gray color. Even if I press out of the tab to a different one the gray tab bar background color doesn't change. The only way I found to dismiss the back ground color after the 5th tab has been selected is to scroll all the way down. After I'm scrolled down it allows the user to see the translucent background again. Then you can select different tab bars and you'll see the translucent background again. How do I only show a translucent color
Upvotes: 1
Views: 4023
Reputation: 11
This is a new default behaviour from iOS 15 and above. Restore the previous styles by doing this in your UITabBarController
:
// prevent views from appearing behind navigation and tab bar
if #available(iOS 13.0, *) {
let tabBarAppearance: UITabBarAppearance = UITabBarAppearance()
tabBarAppearance.configureWithDefaultBackground()
let navAppearance = UINavigationBarAppearance()
navAppearance.configureWithOpaqueBackground()
if #available(iOS 15.0, *) {
UITabBar.appearance().scrollEdgeAppearance = tabBarAppearance
UINavigationBar.appearance().scrollEdgeAppearance = navAppearance
}
}
Based on clues from https://forums.developer.apple.com/forums/thread/682432
Upvotes: 1