iOS 7 and later: set status bar style per view controller

前端 未结 10 681
旧巷少年郎
旧巷少年郎 2020-12-02 07:43


I tried many ways to set the status bar style (default or lightcontent) but can\'t get it to work on a per view controller basis. I can set the status bar style for the

10条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-02 07:54

    I bet you have your view controller embedded into a navigation controller. To avoid setting the navigation bar's style to .Black use this subclass:

    class YourNavigationController: UINavigationController {
        override func childViewControllerForStatusBarStyle() -> UIViewController? {
            return topViewController
        }
    }
    

提交回复
热议问题