CosmicMind / Material

A UI/UX framework for creating beautiful applications.
http://cosmicmind.com
MIT License
11.99k stars 1.26k forks source link

Statusbar text color #1303

Closed kaunteya closed 4 years ago

kaunteya commented 4 years ago

I have my app in NavigationDrawer and the initialization code looks like this

let sidemenuVC = SideMenuViewController.instantiate(fromAppStoryboard: .sideMenu)
drawerController = NavigationDrawerController(
    rootViewController: UINavigationController(),
    leftViewController: sidemenuVC
)
AppDelegate.shared.window?.rootViewController = drawerController

How do I explicitly set the statusbar label color between light and dark?

I tried setting the rootController of NavigationDrawerController by a subclass of UINavigationController which had override preferredStatusBarStyle but it is not getting called

class CustomNavigationController: UINavigationController {
    override var preferredStatusBarStyle: UIStatusBarStyle {
        if #available(iOS 13.0, *) {
            switch Appearance.current {
            case .automatic:
                return .default
            case .dark:
                return .darkContent
            case .light:
                return .lightContent
            }
        }
        return .default
    }
}

let sidemenuVC = SideMenuViewController.instantiate(fromAppStoryboard: .sideMenu)
drawerController = NavigationDrawerController(
    rootViewController: CustomNavigationController(), // <- Note the subclass of UINavigationController
    leftViewController: sidemenuVC
)
AppDelegate.shared.window?.rootViewController = drawerController

My app supports iOS 11 onwards I am using Material 3.1.8(latest)