Search code examples
iosswiftuitableviewuistatusbar

Set status bar color to match UISearchBar


I have a view for search that displays a UITableView with a UISearchBar as tableHeaderView. Scrolling the table, the text underlaps and displays under the status bar. All the solutions I've tried don't work. My preference would be to make the status bar gray, to match the UISearchBar, like suggested here

That and other things I've tried haven't worked. Any help would be appreciated.


Solution

  • The following worked:

    func positionForBar(bar: UIBarPositioning) -> UIBarPosition {
        return .TopAttached
    }
    

    but with the side effect that there's now an offset between the search bar and the first table cell.