'When i use edgesForExtendedLayout = [] my navigation bar not appear in transparently

i am using transparent navigation bar, also i want to set my tableview content below the navigation bar so i am using edgesForExtendedLayout, i can achieved tableview content below navigation bar but navigation bar transparent is not working. It’s showing With default white colour background

i want transparent navigation bar as well as edgesForExtendedLayout = [] both, is there any way to achieve this ?

edgesForExtendedLayout = []

navigation bar transparent code

let textAttributes = [NSAttributedString.Key.foregroundColor: UIColor.colorWhite()]
        navigationController?.navigationBar.tintColor = UIColor.colorWhite()
        navigationController?.navigationBar.backgroundColor = UIColor.clear
        navigationController?.navigationBar.isTranslucent = true

        if #available(iOS 15, *) {
            let appearance = UINavigationBarAppearance()
            appearance.configureWithTransparentBackground()
            appearance.backgroundColor = .clear
            appearance.titleTextAttributes = textAttributes

            // Customizing our navigation bar
            navigationItem.standardAppearance = appearance
            navigationItem.scrollEdgeAppearance = appearance
        } else {
            navigationController?.navigationBar.titleTextAttributes = textAttributes
            navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
            navigationController?.navigationBar.shadowImage = UIImage()
        }

Thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source