How to change UIStatusBarStyle in iOS 7 in modal views with navigation bar?

后端 未结 9 2374
孤独总比滥情好
孤独总比滥情好 2020-12-31 11:32

The iOS 7 Transition Guide give a good hint how to change the UIStatusBarStyle dynamically in a UIViewController using

- (UIStatus         


        
9条回答
  •  傲寒
    傲寒 (楼主)
    2020-12-31 11:57

    I had a side menu/reveal controller (SWRevealController) which turns out to always be the root controller for status bar queries. Overriding childViewControllerForStatusBarStyle let me re-route the query to the front most controller.

    /**
     This view is always considered the topmost for status bar color queries.
     Pass the query along to what we're showing in front.
     */
    - (UIViewController *)childViewControllerForStatusBarStyle
    {
        UIViewController *front = self.frontViewController;
        if ([front isKindOfClass:[UINavigationController class]])
            return ((UINavigationController*)front).topViewController;
        else
            return front;
    }
    

提交回复
热议问题