Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 13 strange search controller gap

Tags:

xcode

swift

ios13

When running the App on iOS 13 beta 6, using Xcode 11 beta 5 I'm encountering the strange gap when presenting search results view controller:

enter image description here

Here's a bit of how this is set up:

let searchResultsController = BLSearchResultsController()  let ret = UISearchController(searchResultsController: searchResultsController) ret.searchResultsUpdater = self ret.delegate = self ret.searchBar.delegate = self; ret.searchBar.autocapitalizationType = .none ret.searchBar.placeholder = NSLocalizedString("SearchMsg", comment: "")         ret.searchBar.enablesReturnKeyAutomatically = true  if #available(iOS 13.0, *) {     ret.searchBar.showsScopeBar = false     ret.searchBar.backgroundColor = .white      let searchTextField = ret.searchBar.searchTextField     searchTextField.font = UIFont.tuttiRegularFont(16)     searchTextField.accessibilityIdentifier = "Main Search Field"     if let searchImageView = searchTextField.leftView as? UIImageView {         searchImageView.image = UIImage(named: "home-search-icon")      } } 

The results search controller is a normal UITableViewController and is just added to the navigationItem.searchController. There is no fancy presentation code. When building on latest live Xcode and running on the iOS 11/12 device this issue is not present which lead me to believe some underlying iOS 13 change might be causing this glitch.

When debugging the view hierarchy it looks like the result view controller does not reach to the top of the moved search bar.

I've tried fiddling with the modalPresentationModes trying to exclude the possibility that the changes to the presentation could be the cause, had no luck there.

Has anyone encountered this issue and had luck fixing it?

like image 559
UrosMi Avatar asked Aug 16 '19 09:08

UrosMi


1 Answers

Setting

extendedLayoutIncludesOpaqueBars = true 

in the UIViewController used to show the search results, fixed the issue for me.

like image 159
DrS Avatar answered Sep 21 '22 18:09

DrS