Sunday, February 18, 2024
HomeiOS Developmentios - UINavigationBar and UITabBar look works just for UINavigationBar

ios – UINavigationBar and UITabBar look works just for UINavigationBar


I have been attempting to change my Toolbars and was capable of lastly getting work with somebody’s assist right here on the UINavigationBar. Nonetheless I attempted to use related method to UITabBarAppearance however I see no modifications. I see no errors or warnings, I additionally tried altering its shade particularly for my part with OnApear and noticed no distinction.

enter image description here

import SwiftUI

@most important
struct ElementApp: App {
    
    init() {
        // Customise UINavigationBar
        let navBarAppearance = UINavigationBarAppearance()
        navBarAppearance.backgroundEffect = UIBlurEffect(fashion: .systemUltraThinMaterial)
        navBarAppearance.backgroundColor = UIColor.black.withAlphaComponent(0.7)
        navBarAppearance.shadowColor = .clear
        UINavigationBar.look().standardAppearance = navBarAppearance
        UINavigationBar.look().compactAppearance = navBarAppearance
        UINavigationBar.look().scrollEdgeAppearance = navBarAppearance

        // Customise UITabBar
        let tabBarAppearance = UITabBarAppearance()
        tabBarAppearance.backgroundEffect = UIBlurEffect(fashion: .systemUltraThinMaterial)
        tabBarAppearance.backgroundColor = UIColor.black.withAlphaComponent(0.7)
        tabBarAppearance.shadowColor = .clear
        UITabBar.look().standardAppearance = tabBarAppearance
        UITabBar.look().scrollEdgeAppearance = tabBarAppearance
    }

    var physique: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments