Different navbar in IOS13

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

Replies

Have you set the transition for the view to fullScreen instead of automatic ?

Both in navController and in navigated views.

I've made a following change in storyboards:

https://i.stack.imgur.com/bKVoH.png


For numbers 1, 2, 3

But still no effect, I was also trying made that in code by setting modalPresentationStyle = .fullScreen but that also didn't make a change.


I decided to make small test and from number 1 (Story board entry point) I've removed connection to Navigation Controller and second view. After that I was running app on iOS13 and iOS12 to spot the difference. It turns out that UINavigationItem starts to become visibility in IOS13 is it somehow connected to translucent option ?


https://i.stack.imgur.com/OiL99.png


My UINavigationItem has UIBarButtonItem underneath

The important is Presentation as fullScreen.


How did you define the segues ?

IThey must not be of type as Popover. But push or modally are OK.

Looked at bthe pictures.


You do not show the attrbutes of the nav controller.

Has it also full screen presentation ?

Same question for its children controllers.