I have a Search Bar working fine created like this for my UITableView Class shown below,
class customTableViewController: UITableViewController, UISearchResultsUpdating
{....
override func viewDidLoad() {
super.viewDidLoad()
self.resultSearchController = ({
let controller = UISearchController(searchResultsController: nil)
controller.searchResultsUpdater = self
controller.dimsBackgroundDuringPresentation = false
controller.searchBar.sizeToFit()
controller.hidesBottomBarWhenPushed = false
controller.hidesNavigationBarDuringPresentation = false
controller.searchBar.searchBarStyle = UISearchBarStyle(rawValue: 2)!
self.tableView.tableHeaderView = controller.searchBar
return controller
})()
self.tableView.reloadData()
}
}
It works fine, it's just that when I segue to another view controller, the image of the search bar remains drawn on my screen no matter what view controller I'm in. When I try "searchBar.active = false", I get nil errors.
What can I do so this searchBar is only drawn on this one tableViewController and nowhere else in my navigation?
Thanks a ton.