Reputation: 3352
There is a very weird bug when I push a control to navigation controller and when I return back, look at the gif below.
Before push the detail view controller
After click on back button from detail view controller
My code:
searchController.obscuresBackgroundDuringPresentation = false
searchController.searchBar.placeholder = Localizations.searching
searchController.hidesNavigationBarDuringPresentation = false
searchController.searchBar.showsScopeBar = true
viewController.navigationItem.searchController = searchController
viewController.navigationItem.hidesSearchBarWhenScrolling = false
viewController.definesPresentationContext = true
Upvotes: 0
Views: 378
Reputation: 1129
Had the same Problem and found a feasible solution:
After you add the TableView to your ViewController, pinn all directions to the safeAreaLayout(or superview)
self.view.addSubview(tableView)
tableView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 0).isActive = true
tableView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 0).isActive = true
tableView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: 0).isActive = true
tableView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: 0).isActive = true
And activate Extend Edges
- Unter Opaque Bars
Upvotes: 0
Reputation: 3352
For the moment I have found a solution but that looks bad.
After push the viewcontroller I must run this:
let searchedText = searchController.searchBar.text
searchController.isActive = false
searchController.searchBar.text = searchedText
Upvotes: 1