Could not access to your image (those ads !). So it is difficult to understand what the problem is.
When you hide the search bar, do you want to move the tableView to the top ?
Maybe in that case you can modify searchBar.frame.size.height ? I've tried but I get some bizarre effects.
Or just hide the background ?
If so, you could set tableView background alpha to zero ?
@IBAction func searchToggle(_ sender: UIBarButtonItem) {
searchBar!.isHidden = !searchBar!.isHidden
if searchBar!.isHidden {
searchBar!.isTranslucent = true
theTableView.backgroundColor = theTableView.backgroundColor?.withAlphaComponent(0.0)
} else {
searchBar!.isTranslucent = false
theTableView.backgroundColor = theTableView.backgroundColor?.withAlphaComponent(1.0)
}
}
To move table when searchBar is hidden, I tried this:
@IBAction func searchToggle(_ sender: UIBarButtonItem) {
searchBar!.isHidden = !searchBar!.isHidden
if searchBar!.isHidden {
searchBar!.isTranslucent = true
theTableView.backgroundColor = theTableView.backgroundColor?.withAlphaComponent(0.0)
theTableView.frame.origin.y = 22
} else {
searchBar!.isTranslucent = false
theTableView.backgroundColor = theTableView.backgroundColor?.withAlphaComponent(1.0)
theTableView.frame.origin.y = 76
}
}