I'm having trouble hiding SearchBar on NavigationItem.
ex: https://www.dropbox.com/s/6is5mukpk1yew8e/bgSearch.gif?dl=0
Using this code:
func scrollViewDidScroll (_ scrollView: UIScrollView) {
let transp: Float = Float (1 - (self.mTableView.contentOffset.y / (self.mTableView.contentSize.height - self.mTableView.frame.size.height) * 60))
self.navigationController! .navigationBar.alpha = CGFloat (transp)
self.mSearchController.searchBar.alpha = CGFloat (transp)
titleMsgView.alpha = CGFloat (transp)
}Everything works fine, except for a background that I could not access to hide with the alpha.
I'm using:
viewDidLoad () {
...
mSearchController = UISearchController (searchResultsController: nil)
mSearchController.delegate = self as? UISearchControllerDelegate
mSearchController.searchResultsUpdater = self
mSearchController.hidesNavigationBarDuringPresentation = false
//mSearchController.searchBar.sizeToFit ()
navigationItem.searchController = mSearchController
...
}As the SerchBar search field disappears correctly, you will understand that it is something with the NavigationItem to which it has been added. Could someone help me solve the problem?