UISearchController changing status bar color on invocation

后端 未结 6 1551
执念已碎
执念已碎 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:29

    Or we can write an extension on Swift (version 2, but you can translate it to 3 easily):

    extension UISearchController {
    
       override public func preferredStatusBarStyle() -> UIStatusBarStyle{
          if Theme.lightTheme() {
              return UIStatusBarStyle.Default
          }
          else {
              return UIStatusBarStyle.LightContent
          }
       }
    }
    

    Where Theme is a class that regulate app colour theme.

提交回复
热议问题