UISearchController changing status bar color on invocation

后端 未结 6 1567
执念已碎
执念已碎 2021-02-08 18:09

I have the following code in my app, specifically in viewDidLoad: that sets up my UISearchController.

self.searchController = [[UISear         


        
6条回答
  •  星月不相逢
    2021-02-08 18:28

    The status bar that is displayed when the search controller is presented (is active) belongs to the search controller. To set the preferred status bar style you must add a category to UISearchController and then override the preferredStatusBarStyle method.

    Below is an example of the implementation file of the category:

    @implementation UISearchController (Customization)
    
    -(UIStatusBarStyle)preferredStatusBarStyle {
        return UIStatusBarStyleLightContent;
    }
    
    @end
    

提交回复
热议问题