Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change statusBar background color when search is active?

I've used UISearchController. When I click on the search bar, navigation bar hides and search bar goes to the top of the screen. But, it shows extra space between top of the screen and the search bar

enter image description here

How do I change statusBar color to default searchBar gray color ?

enter image description here

StatusBar font colour is white, hence when user click search bar, auto above status bar information becomes invisible.So i just need to cover that area by default gray color too, then user can see clearly the status bar.Like this

enter image description here

like image 510
Chathuranga Silva Avatar asked Sep 27 '22 14:09

Chathuranga Silva


1 Answers

The extra space is your status bar which you is lost in your white background.

func viewDidLoad() {
    super.viewDidLoad()
    edgesForExtendedLayout = UIRectEdge.None
}
like image 160
Sahil Kapoor Avatar answered Sep 30 '22 07:09

Sahil Kapoor