4 Replies
      Latest reply on Jan 14, 2020 7:52 AM by Claude31
      iDamian Level 1 Level 1 (0 points)

        Hello,

         

        After making code changes for iOS13 I spot strange looking of my navbar. After watching WWDC 2019 and reading a lot of internet articles I am still not able to make look like in iOS12.

         

        https://aws1.discourse-cdn.com/swift/original/2X/1/1da504f6b72dcb13f4068525e60cbde66b349f27.png

         

        My code:

                let tintColor = Theme.default.accent
        
        
                if #available(iOS 13.0, *) {
                    let navigationBarAppearance = UINavigationBarAppearance()
                               
                    navigationBarAppearance.backgroundColor = UIColor(hexString: "#000000")
                  
                    UINavigationBar.appearance().tintColor = .white
                    navigationBarAppearance.titleTextAttributes = [.foregroundColor: UIColor.white]
                    navigationBarAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
                    UINavigationBar.appearance().isTranslucent = true
                    UINavigationBar.appearance().barTintColor = UIColor(hexString: "#000000")
                    UINavigationBar.appearance().barStyle = UIBarStyle.black
                              
                    UINavigationBar.appearance().scrollEdgeAppearance = navigationBarAppearance
                    UINavigationBar.appearance().compactAppearance = navigationBarAppearance
                    UINavigationBar.appearance().standardAppearance = navigationBarAppearance
        
        
                    UITabBar.appearance().tintColor = tintColor
                               
                    let tabBarAppearance = UITabBarAppearance()
                    tabBarAppearance.backgroundColor = tintColor
                    UITabBar.appearance().standardAppearance = tabBarAppearance
                } else {
                    // Fallback on earlier versions
        
        
                    UINavigationBar.appearance().isTranslucent = true
                    UINavigationBar.appearance().tintColor = .white
                    UINavigationBar.appearance().barTintColor = UIColor(hexString: "#000000")
                    UINavigationBar.appearance().barStyle = UIBarStyle.black
        
        
                    UITabBar.appearance().tintColor = tintColor
                }
        
        
                UISwitch.appearance().onTintColor = tintColor
                UIRefreshControl.appearance().tintColor = tintColor
                UIToolbar.appearance().tintColor = tintColor
        
        
                let popoverBarAppearance = UINavigationBar.appearance(whenContainedInInstancesOf: [UIPopoverPresentationController.self])
                popoverBarAppearance.tintColor = tintColor
                popoverBarAppearance.barTintColor = nil
                popoverBarAppearance.barStyle = .default
        

         

         

        Some ideas what I am missing ?

         

         

        Best regards,

        Damian