UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: Tab Bar Transparent

Forums > iOS

Has anyone had this issue where with the Tab bar at the bottom of an app goes transparent when navigating back from another view. My app is now doing that in iOS 15. The list of items goes behind the tabbar and you can see them. I can not seem to figure out how to solve it.

Can anyone help me with this?

Thanks, Mark

6      

IOS 15 changes the default appearance of Tab bars from opaque to transparent. To make them opaque again, you can use this code

.onAppear {
                // correct the transparency bug for Tab bars
                let tabBarAppearance = UITabBarAppearance()
                tabBarAppearance.configureWithOpaqueBackground()
                UITabBar.appearance().scrollEdgeAppearance = tabBarAppearance
                // correct the transparency bug for Navigation bars
                let navigationBarAppearance = UINavigationBarAppearance()
                navigationBarAppearance.configureWithOpaqueBackground()
                UINavigationBar.appearance().scrollEdgeAppearance = navigationBarAppearance
            }

9      

Thanks Alexis, I appreciate that. I will implement that right away. i have been so frustrated the last coupke weeks trying to figure that out.

4      

I apologize if I typed you name wrong. Will i need to put an onAppear on every view?

4      

Thanks alexismoulin for the info.

appledad05 just add it in the TabView and it will show in all views.

4      

@NigelGee thank you. it works great.

4      

So is this behaviour on a Tab Bar having a transparent background now the default..... or is it a BUG?

4      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.