I added a UISearchBar to the top of the UITableView .
// init search bar self.resultSearchController = ({ let controller = UISearchController(searchResultsController: nil) controller.searchResultsUpdater = self controller.dimsBackgroundDuringPresentation = false controller.searchBar.sizeToFit() controller.searchBar.tintColor = Config.grayColor() controller.searchBar.searchBarStyle = UISearchBarStyle.Minimal self.tableView.tableHeaderView = controller.searchBar // set content offset for table view in order // that the searchbar is hidden at the beginning self.tableView.contentOffset = CGPoint(x: 0, y: controller.searchBar.frame.size.height) return controller })()
It basically looks like this:

But when I enter the search text box and scroll down the table view, it looks weird. The background of the search controller is transparent.

I tried setting barTintColor and backgroundColor , but this has no effect.
Chris source share