Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 15 tab bar transparent after scrolling to the bottom

Tags:

ios15

tabbar

How to fix iOS 15 tab bar transparent after scrolling to the bottom:

iOS 15 transparent tab bar

like image 507
Vlad Khambir Avatar asked Jun 09 '21 07:06

Vlad Khambir


People also ask

Why is my tab bar not displaying the Scroll View?

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).

How to enable the landscape tab bar UI on iOS 15?

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.

Where is the tab bar 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.

How do I get the single tab back on safari?

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.


Video Answer


3 Answers

In iOS 15, UIKit has extended the usage of the scrollEdgeAppearance, which by default produces a transparent background.

enter image description here

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 enter image description here

like image 104
GIJoeCodes Avatar answered Nov 17 '22 06:11

GIJoeCodes


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

scrollEdgeAppearance

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: iOS 15 not transparent tab bar

like image 31
Vlad Khambir Avatar answered Nov 17 '22 06:11

Vlad Khambir


init() {
    if #available(iOS 15, *) {
        let tabBarAppearance: UITabBarAppearance = UITabBarAppearance()
           tabBarAppearance.configureWithOpaqueBackground()
            UITabBar.appearance().standardAppearance = tabBarAppearance
            UITabBar.appearance().scrollEdgeAppearance = tabBarAppearance
    }
}
like image 20
sandorb Avatar answered Nov 17 '22 08:11

sandorb