This is the previous screen.
Then, I clicked the search bar:
Code is below: // MARK: - searchController
func initSearchController() {
self.resultSearchController = ({
let controller = UISearchController(searchResultsController: nil)
controller.searchResultsUpdater = self
controller.dimsBackgroundDuringPresentation = false
controller.searchBar.sizeToFit()
controller.searchBar.backgroundColor = UIColor.clearColor()
self.tableView.tableHeaderView = controller.searchBar
return controller
})()
}
Please help me. Thanks.
Set the title of the section to nil, if there are no rows in that section, this would hide the section title
This will work, assuming
tableView(tableView: UITableView, numberOfRowsInSection section: Int)
is implemented properly to reflect the number of sections based on the search result.If you want to remove the section title altogether when the search bar is active, then just add this