UISearchController apply wrong contentInset to its resultController
Originator: | alessandro.calzavara | ||
Number: | rdar://27590153 | Date Originated: | 28-Jul-2016 |
Status: | Open | Resolved: | No |
Product: | iOS | Product Version: | 10.0 |
Classification: | Reproducible: | Yes |
ummary: On iOS10beta3, a UITableViewController displayed by UISearchController has the wrong top contentInset 84 instead of 64. See attached screenshots. The same code on iOS 8 and 9 works correctly. Everything is compiled with Xcode 8 beta3 Steps to Reproduce: Create a UISearchController like this // Create hints controller self.hintsController = SPKSearchHintsViewController() // it's a plain UITableViewController // Create search controller self.searchController = UISearchController(searchResultsController: self.hintsController) self.searchController.searchResultsUpdater = self.hintsController self.searchController.hidesNavigationBarDuringPresentation = false self.searchController.dimsBackgroundDuringPresentation = false self.definesPresentationContext = true // Prepare searchBar let searchBar = self.searchController.searchBar searchBar.delegate = self searchBar.placeholder = NSLocalizedString("search_placeholder", comment: "Search") searchBar.keyboardType = .ASCIICapable searchBar.tintColor = UIColor.darkGrayColor() self.navigationItem.titleView = searchBar // add it to navigation bar Expected Results: The contentInset of the tableView inside resultController should be 64 Like the screenshot on iOS 9 attached Actual Results: The contentInset.top is 84. See screenshot attached Version: iOS 10.0 14A5309d
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Same here!!
I'm getting the same thing. Downloading the sample app Apple provided here https://developer.apple.com/library/ios/samplecode/TableSearch_UISearchController/Introduction/Intro.html#//apple_ref/doc/uid/TP40014683 and
remove
self.tableView.tableHeaderView = self.searchController.searchBar;
and add
self.searchController.hidesNavigationBarDuringPresentation = NO; self.navigationItem.titleView = self.searchController.searchBar;
to make the search bar appear in navigation bar. Then search for "i", tap into any search, and hit back, you can notice the search result table increases its inset, resulting in huge whitespace.